From 692dbfd02d90e7334d1586f11a41038bd0abf09b Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Wed, 12 Nov 2014 13:55:59 +0100 Subject: [PATCH 001/138] 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* methods, TRAPS) const { @@ -521,7 +521,7 @@ Symbol* MethodFamily::generate_conflicts_message(GrowableArray* 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* 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* 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 Date: Tue, 11 Nov 2014 13:39:00 -0500 Subject: [PATCH 002/138] 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 Date: Thu, 13 Nov 2014 11:14:01 +0100 Subject: [PATCH 003/138] 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 Date: Fri, 14 Nov 2014 09:47:09 +0100 Subject: [PATCH 004/138] 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 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) + MAX2(length - 1, 0) * sizeof(T); } From 4feb7b4dab063fd7ca4b6fb9cadb7d38ee4bac82 Mon Sep 17 00:00:00 2001 From: Mikael Gerdin Date: Fri, 14 Nov 2014 14:23:25 +0100 Subject: [PATCH 005/138] 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 Date: Fri, 14 Nov 2014 15:03:39 +0100 Subject: [PATCH 006/138] 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::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 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 Date: Tue, 11 Nov 2014 17:05:33 +0100 Subject: [PATCH 007/138] 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 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 Date: Wed, 12 Nov 2014 12:41:59 +0100 Subject: [PATCH 008/138] 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 Mutex* FreeBlockDictionary::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 Date: Tue, 18 Nov 2014 10:23:26 +0100 Subject: [PATCH 009/138] 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::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 { 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 { 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 { 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 { 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 { // 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 { // 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 { 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 Date: Tue, 18 Nov 2014 10:36:42 +0100 Subject: [PATCH 010/138] 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 { 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 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 Date: Tue, 18 Nov 2014 10:39:16 +0100 Subject: [PATCH 011/138] 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::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 Date: Tue, 21 Oct 2014 15:07:25 +0200 Subject: [PATCH 012/138] 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: // compare-and-exchange - 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 Date: Thu, 30 Oct 2014 10:51:06 +0100 Subject: [PATCH 013/138] 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 { // 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 Date: Thu, 30 Oct 2014 12:45:22 +0100 Subject: [PATCH 014/138] 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 + friend void CompactibleSpace::scan_and_adjust_pointers(SpaceType* space); + template + friend void CompactibleSpace::scan_and_compact(SpaceType* space); + template + 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 + 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 { // 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 + static inline void scan_and_adjust_pointers(SpaceType* space); + + // Frequently calls obj_size(). + template + static inline void scan_and_compact(SpaceType* space); + + // Frequently calls scanned_block_is_obj() and scanned_block_size(). + // Requires the scan_limit() function. + template + 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 + 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 +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 +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 +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 Date: Fri, 31 Oct 2014 09:10:51 +0100 Subject: [PATCH 015/138] 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.*; - -/**

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: prepend in front of bootstrap class path -Xnoclassgc disable class garbage collection - -Xincgc enable incremental garbage collection -Xloggc: log GC status to a file with time stamps -Xbatch disable background compilation -Xms 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 { // 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 { // 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 { 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 { // 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 { 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 { // 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 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 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 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 Date: Mon, 3 Nov 2014 11:29:00 +0100 Subject: [PATCH 016/138] 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 Date: Mon, 3 Nov 2014 12:49:21 +0100 Subject: [PATCH 017/138] 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 Date: Wed, 5 Nov 2014 10:12:51 +0100 Subject: [PATCH 018/138] 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 Date: Wed, 5 Nov 2014 16:39:10 +0100 Subject: [PATCH 019/138] 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 Date: Wed, 5 Nov 2014 15:50:14 +0100 Subject: [PATCH 020/138] 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 Date: Mon, 3 Nov 2014 11:08:03 +0100 Subject: [PATCH 021/138] 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 Date: Fri, 7 Nov 2014 15:34:33 -0800 Subject: [PATCH 022/138] 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* // 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 Date: Mon, 10 Nov 2014 12:13:46 +0100 Subject: [PATCH 023/138] 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 @@ 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 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 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 Date: Sat, 8 Nov 2014 16:00:28 +0300 Subject: [PATCH 030/138] 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 913c598d6c1f196432655d311553a56e8bb6a337 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Sat, 8 Nov 2014 16:01:10 +0300 Subject: [PATCH 031/138] 8063157: add targets for optimized builds Reviewed-by: kvn, dholmes --- make/jprt.properties | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/make/jprt.properties b/make/jprt.properties index 1a268de8353..dbe27081b20 100644 --- a/make/jprt.properties +++ b/make/jprt.properties @@ -50,14 +50,18 @@ jprt.build.flavor.debugOpen.target=jprt_bundle jprt.build.flavor.fastdebug.target=jprt_bundle jprt.build.flavor.product.target=jprt_bundle jprt.build.flavor.productOpen.target=jprt_bundle +jprt.build.flavor.optimized.target=jprt_bundle +jprt.build.flavor.optimizedOpen.target=jprt_bundle # Use these configure args to define debug level jprt.debug.build.configure.args=--with-debug-level=slowdebug jprt.fastdebug.build.configure.args=--with-debug-level=fastdebug jprt.product.build.configure.args=--with-debug-level=release +jprt.optimized.build.configure.args=--with-debug-level=optimized jprt.debugOpen.build.configure.args=${jprt.debug.build.configure.args} --enable-openjdk-only jprt.fastdebugOpen.build.configure.args=${jprt.fastdebug.build.configure.args} --enable-openjdk-only jprt.productOpen.build.configure.args=${jprt.product.build.configure.args} --enable-openjdk-only +jprt.optimizedOpen.build.configure.args=${jprt.product.build.configure.args} --enable-openjdk-only # Select build flavors and build targets jprt.build.flavors=${my.is.hotspot.job ? ${my.build.flavors.hotspot} : ${my.build.flavors.default}} @@ -230,18 +234,18 @@ my.make.rule.test.targets.jck= \ # The hotspot build flavors my.build.flavors.hotspot= \ - debugOpen,fastdebug,product,productOpen, \ + debugOpen,fastdebug,product,productOpen,optimized,optimizedOpen \ ${my.additional.build.flavors.hotspot} # Platforms built for hotspot push jobs my.build.targets.hotspot= \ - solaris_sparcv9_5.11-{product|fastdebug|optimized}, \ + solaris_sparcv9_5.11-{product|fastdebug}, \ solaris_x64_5.11-{product|fastdebug}, \ linux_i586_2.6-{product|fastdebug}, \ - linux_x64_2.6-{product|fastdebug|optimized}, \ + linux_x64_2.6-{product|fastdebug}, \ macosx_x64_10.7-{product|fastdebug}, \ windows_i586_6.1-{product|fastdebug}, \ - windows_x64_6.1-{product|fastdebug|optimized}, \ + windows_x64_6.1-{product|fastdebug}, \ solaris_x64_5.11-{debugOpen}, \ linux_x64_2.6-{productOpen}, \ ${my.additional.build.targets.hotspot} From bdac8228110c81efccee4fffe2eddcb4cc42e528 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Mon, 10 Nov 2014 19:04:38 +0300 Subject: [PATCH 032/138] 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* _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 + #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 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 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 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 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 SEGMENTED_TYPES + = EnumSet.complementOf(EnumSet.of(BlobType.All)); + + public static void main(String[] args) { + EnumSet 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 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 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 5ccaf44879591eaef30f9a3df35febac4401b325 Mon Sep 17 00:00:00 2001 From: Calvin Cheung Date: Mon, 10 Nov 2014 10:13:10 -0800 Subject: [PATCH 033/138] 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 bbd7b058d18c5dd72c9a8748f88d8a928e3bddae Mon Sep 17 00:00:00 2001 From: Eric McCorkle Date: Mon, 10 Nov 2014 16:45:46 -0500 Subject: [PATCH 034/138] 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 Date: Mon, 10 Nov 2014 19:28:51 -0500 Subject: [PATCH 035/138] 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 Date: Mon, 10 Nov 2014 19:37:32 -0500 Subject: [PATCH 036/138] 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 Date: Tue, 11 Nov 2014 11:05:41 +0100 Subject: [PATCH 037/138] 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 ( or ). 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 Date: Tue, 11 Nov 2014 15:07:09 +0300 Subject: [PATCH 038/138] 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 Date: Tue, 11 Nov 2014 04:34:56 -0800 Subject: [PATCH 039/138] 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 Date: Tue, 11 Nov 2014 04:46:13 -0800 Subject: [PATCH 040/138] 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* 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 Date: Tue, 11 Nov 2014 09:59:50 -0500 Subject: [PATCH 041/138] 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 afd3405c2f668f752bfaa8e111ac745e3b506220 Mon Sep 17 00:00:00 2001 From: Jiangli Zhou Date: Wed, 12 Nov 2014 13:12:35 -0500 Subject: [PATCH 042/138] 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 f8712e7800e1d611018d05e0a4b6bf402f079f90 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Thu, 13 Nov 2014 01:57:09 +0300 Subject: [PATCH 043/138] 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 ""; } - 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 = ""; From 959631d58da1c852c94eff94a0bf9248c88ab4dd Mon Sep 17 00:00:00 2001 From: David Holmes Date: Wed, 12 Nov 2014 19:05:59 -0500 Subject: [PATCH 044/138] 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 Date: Wed, 12 Nov 2014 16:22:12 -0800 Subject: [PATCH 045/138] 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 bc52e8443ead19ed758a12a758673f9922a57eeb Mon Sep 17 00:00:00 2001 From: Nils Eliasson Date: Thu, 13 Nov 2014 14:42:54 +0100 Subject: [PATCH 046/138] 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 { class CompileQueue : public CHeapObj { private: const char* _name; - Monitor* _lock; CompileTask* _first; CompileTask* _last; @@ -206,9 +205,8 @@ class CompileQueue : public CHeapObj { 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 { } 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 f81bd8ff29e46c32439e51559916cc041eee087c Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Mon, 17 Nov 2014 12:57:49 +0300 Subject: [PATCH 047/138] 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 f3d9096e4dac9a267d8e888945d13dd18732c304 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Mon, 17 Nov 2014 14:02:45 -0800 Subject: [PATCH 048/138] 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 68b0d32b05be03cd0851327105e08bd17717bc1c Mon Sep 17 00:00:00 2001 From: Zoltan Majo Date: Tue, 18 Nov 2014 19:44:45 +0100 Subject: [PATCH 049/138] 8062854: move compiler jtreg test to corresponding subfolders and use those in TEST.groups Move all test from directories to /; 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 5ef6d4e99d568bb59de16c526d039bed80807b5c Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Thu, 20 Nov 2014 11:06:26 +0100 Subject: [PATCH 050/138] 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 bf5546e48d73a99da21a94e4dc8a542b1424235b Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Fri, 21 Nov 2014 17:27:11 +0300 Subject: [PATCH 051/138] 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 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 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 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 Date: Fri, 21 Nov 2014 17:28:29 +0300 Subject: [PATCH 052/138] 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 f36e847523819ea488b6fcf4a3c76382d62ec49e Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Fri, 21 Nov 2014 17:17:41 -0800 Subject: [PATCH 053/138] 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 Date: Mon, 24 Nov 2014 08:48:15 +0100 Subject: [PATCH 054/138] 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 Date: Mon, 24 Nov 2014 07:29:03 -0800 Subject: [PATCH 055/138] 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 Date: Thu, 13 Nov 2014 09:19:46 +0100 Subject: [PATCH 056/138] 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 8f3190b805064eb1cb4b76aa5bc03da59baba9a1 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Thu, 13 Nov 2014 19:12:28 +0300 Subject: [PATCH 057/138] 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" Date: Thu, 13 Nov 2014 10:39:35 -0800 Subject: [PATCH 058/138] 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: + # - . + # - .. + # + # 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 -#include -#include -#include -#include -#include - -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 -#include -#include -#include -#include -#include - -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 Date: Fri, 14 Nov 2014 12:45:55 -0500 Subject: [PATCH 059/138] 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 Date: Fri, 14 Nov 2014 13:09:53 -0500 Subject: [PATCH 060/138] 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]; // =xxx form // [-|+] 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()) ? "" : "="); + 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 Date: Mon, 17 Nov 2014 11:26:43 -0500 Subject: [PATCH 061/138] 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 Date: Thu, 13 Nov 2014 16:58:56 +0100 Subject: [PATCH 062/138] 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 #include +// 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 cb0c3ed7ae7ce6d8b2fb83f63e8ea1e9ddb933b1 Mon Sep 17 00:00:00 2001 From: Mikael Auno Date: Fri, 14 Nov 2014 10:29:01 +0100 Subject: [PATCH 063/138] 8064799: [TESTBUG] JT-Reg Serviceability tests to be run as part of JPRT submit job Reviewed-by: sla, alanb, dholmes, sspitsyn --- make/jprt.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/make/jprt.properties b/make/jprt.properties index 1a268de8353..31cd43b2981 100644 --- a/make/jprt.properties +++ b/make/jprt.properties @@ -491,4 +491,5 @@ my.make.rule.test.targets.hotspot= \ ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_runtime}, \ ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_runtime_closed}, \ ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_serviceability}, \ + ${my.make.rule.test.targets.hotspot.reg.group:GROUP=jdk_svc_sanity}, \ ${my.additional.make.rule.test.targets.hotspot} From e158f32141f6c06346fb4e062bd7dd0ce40166ac Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Fri, 14 Nov 2014 11:58:28 +0100 Subject: [PATCH 064/138] 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 { + void canThrow() throws Y; + } + + public static void wrap(Throwing action) { + } + + public static void invoke(String a) { + Runnable r = new Runnable() { + @Override + public void run() { + wrap(() -> System.out.println(a)); + } + }; + } +} From da1287a38fd498ca58db1d7dace53816e5faa8b4 Mon Sep 17 00:00:00 2001 From: Andrey Zakharov Date: Fri, 14 Nov 2014 17:36:56 +0400 Subject: [PATCH 065/138] 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 42c6853ed1f3f6ba5783f47a7b94e78830c5d044 Mon Sep 17 00:00:00 2001 From: Sergey Lugovoy Date: Mon, 17 Nov 2014 14:57:28 +0300 Subject: [PATCH 066/138] 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 ad0645eb58d386fb427eafdc3c41e0e004922ed7 Mon Sep 17 00:00:00 2001 From: Marcus Lagergren Date: Mon, 17 Nov 2014 14:36:15 +0100 Subject: [PATCH 067/138] 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 5bb86103a9d71205f00e4fcc1483b2983be99193 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Mon, 17 Nov 2014 23:41:56 +0000 Subject: [PATCH 068/138] 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 process() throws Exception; + } + + interface ParentB { + T process() throws Exception; + } + + interface Child extends ParentA, ParentB { } + + static class ChildImpl implements Child { + @Override + public T process() { + return null; + } + } + + public static void main(String[] args) throws Exception { + Child child = new ChildImpl(); + child.process(); + } +} From 9d6d069c222d8a65983c0494ab2f0fd3b777ee2b Mon Sep 17 00:00:00 2001 From: Michael Fang Date: Mon, 17 Nov 2014 23:11:05 -0800 Subject: [PATCH 069/138] 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 Date: Tue, 18 Nov 2014 19:17:16 +0100 Subject: [PATCH 070/138] 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 Date: Tue, 18 Nov 2014 10:19:04 -0800 Subject: [PATCH 071/138] 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 Date: Tue, 18 Nov 2014 03:38:50 -0800 Subject: [PATCH 072/138] 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 20802dbd08b1e1a217730a049aaeac9b573ff76d Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Tue, 18 Nov 2014 16:07:57 +0100 Subject: [PATCH 073/138] 8065183: Add --with-copyright-year option to configure Reviewed-by: ihse, tbell --- common/autoconf/generated-configure.sh | 18 ++++++++++++++++-- common/autoconf/jdk-options.m4 | 10 +++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index ee4a8945ede..23d5bcb1829 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -1065,6 +1065,7 @@ with_milestone with_update_version with_user_release_suffix with_build_number +with_copyright_year with_boot_jdk with_add_source_root with_override_source_root @@ -1906,6 +1907,7 @@ Optional Packages: Add a custom string to the version string if build number is not set.[username_builddateb00] --with-build-number Set build number value for build [b00] + --with-copyright-year Set copyright year value for build [current year] --with-boot-jdk path to Boot JDK (used to bootstrap build) [probed] --with-add-source-root for each and every source directory, look in this additional source root for the same directory; if it @@ -4328,7 +4330,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=1416323245 ############################################################################### # @@ -20134,7 +20136,19 @@ fi - COPYRIGHT_YEAR=`date +'%Y'` + +# Check whether --with-copyright-year was given. +if test "${with_copyright_year+set}" = set; then : + withval=$with_copyright_year; +fi + + if test "x$with_copyright_year" = xyes; then + as_fn_error $? "Copyright year must have a value" "$LINENO" 5 + elif test "x$with_copyright_year" != x; then + COPYRIGHT_YEAR="$with_copyright_year" + else + COPYRIGHT_YEAR=`date +'%Y'` + fi if test "x$JDK_UPDATE_VERSION" != x; then diff --git a/common/autoconf/jdk-options.m4 b/common/autoconf/jdk-options.m4 index 3f0165e52b5..39239fa80d8 100644 --- a/common/autoconf/jdk-options.m4 +++ b/common/autoconf/jdk-options.m4 @@ -549,7 +549,15 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VERSION_NUMBERS], AC_SUBST(MACOSX_BUNDLE_NAME_BASE) AC_SUBST(MACOSX_BUNDLE_ID_BASE) - COPYRIGHT_YEAR=`date +'%Y'` + AC_ARG_WITH(copyright-year, [AS_HELP_STRING([--with-copyright-year], + [Set copyright year value for build @<:@current year@:>@])]) + if test "x$with_copyright_year" = xyes; then + AC_MSG_ERROR([Copyright year must have a value]) + elif test "x$with_copyright_year" != x; then + COPYRIGHT_YEAR="$with_copyright_year" + else + COPYRIGHT_YEAR=`date +'%Y'` + fi AC_SUBST(COPYRIGHT_YEAR) if test "x$JDK_UPDATE_VERSION" != x; then From a669f5bd5840e7137b1eab1055f8b54973b54a0a Mon Sep 17 00:00:00 2001 From: Frank Yuan Date: Tue, 18 Nov 2014 12:01:27 -0800 Subject: [PATCH 074/138] 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 @@ + + + + test + + + + information + + 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 @@ + + + + + + + + + + + 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 @@ + + +1 +2 + 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 @@ + + + + + + + + + + + + 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 = "\n" + "\n" + " \n" + + " \n" + " \n" + " \n" + + " \n" + " \n" + "\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 @@ + +0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789[END] 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 @@ + +123 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 @@ + + + + + + + + + + + + + + + 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 @@ + + + 123 + 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 @@ + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + 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 = "\n" + "\n" + " \n" + + " \n" + " \n" + " \n" + + " \n" + " \n" + "\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("]>"); + w.println("&aux;"); + w.flush(); + w.close(); + File aux = new File(dir, "aux1.xml"); + w = new PrintWriter(new FileWriter(aux)); + w.println(""); + 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 @@ + + + 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 @@ + + Doofus + McGee + 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 @@ + + + + + + + + + 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 = "" + "" + ""; + + runTest(XML); + + } + + @Test + public void test1() { + final String XML = "" + "" + ""; + 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 = "\n" + + "\n" + + "\n" + "\n" + "\n" + + "soapenv:Server\n" + "\n" + "com.sun.ts.tests.jaxws.sharedwebservices.faultservice.DummyException\n" + + "\n" + "\n" + "\n" + "dummyString1\n" + "\n" + "dummyString2\n" + + "\n" + "\n" + "\n" + "\n" + "\n"; + + // simplest XML to re-declare same prefix/namespace mappings + private static final String SIMPLE_TESTXML = "\n" + "\n" + + "\n" + "\n" + "\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 @@ + + +%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 @@ + + + +Some Title + + +

Some Title

+

This is a test. This is only a test.

+ + 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 @@ + 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 ">". + */ +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(" (" + 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("".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("".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 @@ + 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 @@ + + + + + + + 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 @@ + + + + + + +test + 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 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 @@ + + + + + Boss Big + chief@foo.com + + + + + Worker One + one@foo.com + + + + + Worker Two + two@foo.com + + + + + Worker Three + three@foo.com + + + + + Worker Four + four@foo.com + + + + + Worker Five + five@foo.com + + + + 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 @@ + + + + + Boss Big + chief@foo.com + + + + + Worker One + one@foo.com + + + + + Worker Two + two@foo.com + + + + + Worker Three + three@foo.com + + + + + Worker Four + four@foo.com + + + + + Worker Five + five@foo.com + + + + 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("")); + 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 @@ + + + + + + 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 @@ + + + + + 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 @@ + +<_test01><_test-04>T%e!s#t$
1000509.90.0860833333333333345134545.22916666666667114.44-16.886.70A1Vn

2000503.80.08438888888888889-003011-0.503055555555555698.33-61.146.29gG9

3Psc33 Psc000520.10.08891666666666666-054227-5.707500000000000593.75-65.934.61K0IIIbCN-0.5

4Peg86 Peg000542.00.09513234613.39611111111111106.19-47.985.51G5III

5000616.00.1044444444444444558261258.43666666666666117.03-03.925.96G5V

6000619.00.10527777777777779-490430-49.075321.61-66.385.70G1IV

7Cas10 Cas000626.50.1073611111111111264114664.19611111111111118.061.755.59B9III

8000636.80.1102222222222222229011729.02138888888889111.26-32.836.13K0V

9000650.10.11391666666666667-230627-23.107552.21-79.146.18A7V

10000718.20.12172222222222222-172311-17.38638888888888874.36-75.906.19A6Vn
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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + +]> +&writer;©right;&something;&something; 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 @@ + + +]> &s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&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s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s; 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + id2 + 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 @@ + + + + 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 @@ + + + + + + + Lego-Model01 + 65.99 + + + Lego-Model2 + 69.99 + + + Lego-Model3 + 14.99 + + + Barbie-Pink + 12.99 + + + Barbie-Blue + 13.99 + + + Barbie-White + 13.99 + + + Barbie-Plain + 13.99 + + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + 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 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 @@ + + + + + + + + + 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 @@ + + +Node1 Value +Node2 Value + +Node4 Value + +Node6 Value + + + + 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 = "" + ""; + + @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 = "The Tragedy of Hamlet, Prince of Denmark"; + + @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 + 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> +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + +<a111111111a> + <b111111111b> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <c111111111c> + <b111111111b> +<a111111111a> + + </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 "< ... >". + */ +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>&< <![CDATA[cdatastart<><>>><>><<<<cdataend]]> entitystart &a; entityend</foo> + &b; + <description>a&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 + 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 @@ + + The Tragedy of Hamlet + Prince of Denmark + + + William Shakespeare + + + 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 @@ + +Getting started with SGML + +The business challenge + +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. +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. + + +Getting to know SGML + +While SGML is a fairly recent technology, the use of +markup in computer-generated documents has existed for a +while. +
+What is markup, or everything you always wanted to know about +document preparation but were afraid to ask? + +Markup is everything in a document that is not content. The +traditional meaning of markup is the manual marking 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 procedural markup. + +Procedural markup +Most electronic publishing systems today use some form of +procedural markup. Procedural markup codes are good for one +presentation of the information. + +Generic markup +Generic markup (also known as descriptive markup) describes the +purpose 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. + +Drawbacks of procedural markup +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.
+
+What <emph>is</emph> SGML in the grand scheme of the universe, anyway? + +SGML defines a strict markup scheme with a syntax for defining +document data elements and an overall framework for marking up +documents. +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.
+
+How is SGML and would you recommend it to your grandmother? + +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. + +Structure +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. +A database schema also defines the relationships between the +various types of data. Similarly, a DTD specifies rules +to help ensure documents have a consistent, logical structure. + +Content +Content is the information itself. The method for identifying +the information and its meaning within this framework is called +tagging. Tagging must +conform to the rules established in the DTD (see ). + + +Style +SGML does not standardize style or other processing methods for +information stored in SGML.
+ +Resources +
+Conferences, tutorials, and training + +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. +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. + +
+
+
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 = ""; + final String EXPECTED_OUTPUT_NO_ENCODING = ""; + + // 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 @@ + + + + + + + + + Comment describing your root element + + + + + + + + + + + + + + + + + + + + Canonical Data Model for service checkAddress (result) + Generation Date: 20.12.2005 + naming convention for prefixes: + CDM - object type + DOM - reference data type + + + + + + + + + + + + + + + + + + + + + + physical existing postal address + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Address with special geographical information (GIS) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deutschland + + + + + + + + + + + + + + + + + + + + + + + + + + + + Comment describing your root element + + + + + + + + + + + Comment describing your root element + + + + + + + + + + + + + + + + + + + + Canonical Data Model for service checkAddress + Generation Date: 20.12.2005 + naming convention for prefixes: + CDM - object type + DOM - reference data type + + + + + + physical existing postal address + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Address with special geographical information (GIS) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deutschland + + + + + + + + + + + + + + + + + + + + + + + + + + + + Comment describing your root element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The operation has no documentation + + + + + + + + + + + + + + + + + + + + + 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 @@ + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 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 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 + // 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 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 @@ + + + +]> +&replace; 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 @@ + + + + + + + + ccccccc + 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 @@ + + +zzzzzzzzz 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 @@ + + The Tragedy of Hamlet + Prince of Denmark + + + 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 = ""; + 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 = "" + "" + ""; + + // 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 = ""; + 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 = ""; + + 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 = ""; + + 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 = ""; + + 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 @@ + + + + +]> +&replace; 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 = "" + ""; + + 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(""); + 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(""); + sbuffer.append(""); + // 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 @@ + +this is some text + + 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(""); + sbuffer.append("<" + rootElement + " xmlns:"); + sbuffer.append(prefix); + sbuffer.append("=\"" + namespaceURI + "\">"); + sbuffer.append("<" + prefix + ":" + childElement + ">"); + sbuffer.append("blahblah"); + sbuffer.append(""); + sbuffer.append(""); + // 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 @@ + + + Hello World! + 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 = "abc]]>xyz"; + 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("")); + 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 "); + Assert.assertTrue(re.getNamespaceCount() == 2, "Two namespaces are expected for "); + } + } + } 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 "); + + Iterator attributes = startElement.getAttributes(); + count = 0; + while (attributes.hasNext()) { + iterator.next(); + count++; + } + Assert.assertTrue(count == 0, "Zero attributes are expected for "); + } + } + } + } 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 = ""; + + 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 = ""; + + 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 = ""; + + 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 = ""; + + 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 @@ + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + 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 @@ + + +]> + + + The Publishers + + Alfred Publishing + 15535 Morrison + South Oaks CA 91403 + &max; + + eXtensible Markup Language + + + + 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 @@ + + +]> + + + The Publishers + + Alfred Publishing + 15535 Morrison + South Oaks CA 91403 + &max; + + eXtensible Markup Language + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + Hello World! + 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 @@ + + + + +]> + + Hello &foo; World! + 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 = ""; + + 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 = ""; + + 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 = ""; + + 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 = ""; + + 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 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 @@ + + 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 @@ + + 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 @@ + + 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(""); + sbuffer.append("<" + rootElement + " xmlns:"); + sbuffer.append(prefix); + sbuffer.append("=\"" + namespaceURI + "\">"); + sbuffer.append("<" + prefix + ":" + childElement + ">"); + sbuffer.append("blahblah"); + sbuffer.append(""); + sbuffer.append(""); + // 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 = "" + "\n" + "\n" + + "\n" + "\n" + + "\n" + "]>" + "&intEnt;"; + + final String XML1 = "" + "" + "" + "&mkm;" + ""; + + // final String XML1 = "" + "" + "" + // + "&mkm;" + ""; + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + 12345678 person.addressperson.administrativeGenderCodeperson.birthTimeMatthewBarrowperson.name 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%xs-datatypes; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]> + + + + 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 + + + + + + The schema corresponding to this document is normative, + with respect to the syntactic constraints it expresses in the + XML Schema language. The documentation (within <documentation> elements) + below, is not normative, but rather highlights important aspects of + the W3C Recommendation of which this is a part + + + + + The simpleType element and all of its members are defined + towards the end of this schema document + + + + + + Get access to the xml: attribute groups for xml:lang + as declared on 'schema' and 'documentation' below + + + + + + + + This type is extended by almost all schema types + to allow attributes from other namespaces to be + added to user schemas. + + + + + + + + + + + + + This type is extended by all types which allow annotation + other than <schema> itself + + + + + + + + + + + + + + + + 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. + + + + + + + + + + + + + This group is for the + elements which can self-redefine (see <redefine> below). + + + + + + + + + + + + + A utility type, not for public use + + + + + + + + + + + A utility type, not for public use + + + + + + + + + + + A utility type, not for public use + + #all or (possibly empty) subset of {extension, restriction} + + + + + + + + + + + + + + + + + A utility type, not for public use + + + + + + + + + + + + + A utility type, not for public use + + #all or (possibly empty) subset of {extension, restriction, list, union} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + for maxOccurs + + + + + + + + + + + + for all particles + + + + + + + for element, group and attributeGroup, + which both define and reference + + + + + + + + 'complexType' uses this + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This branch is short for + <complexContent> + <restriction base="xs:anyType"> + ... + </restriction> + </complexContent> + + + + + + + + + + + + + + + Will be restricted to required or forbidden + + + + + + Not allowed if simpleContent child is chosen. + May be overriden by setting on complexContent child. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This choice is added simply to + make this a valid restriction per the REC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Overrides any setting on complexType parent. + + + + + + + + + + + + + + + This choice is added simply to + make this a valid restriction per the REC + + + + + + + + + + + + + + + + + No typeDefParticle group reference + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A utility type, not for public use + + #all or (possibly empty) subset of {substitution, extension, + restriction} + + + + + + + + + + + + + + + + + + + + + + + + + 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. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + group type for explicit groups, named top-level groups and + group references + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + group type for the three kinds of group + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This choice with min/max is here to + avoid a pblm with the Elt:All/Choice/Seq + Particle derivation constraint + + + + + + + + + + restricted max/min + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Only elements allowed inside + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + simple type for the value of the 'namespace' attr of + 'any' and 'anyAttribute' + + + + 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 + + + + + + A utility type, not for public use + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A subset of XPath expressions for use +in selectors + A utility type, not for public +use + + + + 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 + + + + + + + + + + + + + + + + + + + + + + + A subset of XPath expressions for use +in fields + A utility type, not for public +use + + + + The following pattern is intended to allow XPath + expressions per the same EBNF as for selector, + with the following change: + Path ::= ('.//')? ( Step '/' )* ( Step | '@' NameTest ) + + + + + + + + + + + + + + + + + + + + + + + + + + + The three kinds of identity constraints, all with + type of or derived from 'keybase'. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A utility type, not for public use + + A public identifier, per ISO 8879 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + notations for use within XML Schema schemas + + + + + + + + + Not the real urType, but as close an approximation as we can + get in the XML representation + + + + + + + + + + First the built-in primitive datatypes. These definitions are for + information only, the real built-in definitions are magic. + + + + 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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. + + + + + + + + + + Now the derived primitive types + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pattern specifies the content of section 2.12 of XML 1.0e2 + and RFC 3066 (Revised version of RFC 1766). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pattern matches production 7 from the XML spec + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pattern matches production 5 from the XML spec + + + + + + + + + + + + + + + pattern matches production 4 from the Namespaces in XML spec + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A utility type, not for public use + + + + + + + + + + + + + + + + + + + + + + #all or (possibly empty) subset of {restriction, union, list} + + + A utility type, not for public use + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Can be restricted to required or forbidden + + + + + + + + + + + + + + + + + + Required at the top level + + + + + + + + + + + + + + + + + + + Forbidden when nested + + + + + + + + + + + + + + + + + + + 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. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + base attribute and simpleType child are mutually + exclusive, but one or other is required + + + + + + + + + + + + + + + + itemType attribute and simpleType child are mutually + exclusive, but one or other is required + + + + + + + + + + + + + + + + + + memberTypes attribute must be non-empty or there must be + at least one simpleType child + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + +Getting started with SGML + +The business challenge + +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. +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. + + +Getting to know SGML + +While SGML is a fairly recent technology, the use of +markup in computer-generated documents has existed for a +while. +
+What is markup, or everything you always wanted to know about +document preparation but were afraid to ask? + +Markup is everything in a document that is not content. The +traditional meaning of markup is the manual marking 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 procedural markup. + +Procedural markup +Most electronic publishing systems today use some form of +procedural markup. Procedural markup codes are good for one +presentation of the information. + +Generic markup +Generic markup (also known as descriptive markup) describes the +purpose 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. + +Drawbacks of procedural markup +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.
+
+What <emph>is</emph> SGML in the grand scheme of the universe, anyway? + +SGML defines a strict markup scheme with a syntax for defining +document data elements and an overall framework for marking up +documents. +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.
+
+How is SGML and would you recommend it to your grandmother? + +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. + +Structure +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. +A database schema also defines the relationships between the +various types of data. Similarly, a DTD specifies rules +to help ensure documents have a consistent, logical structure. + +Content +Content is the information itself. The method for identifying +the information and its meaning within this framework is called +tagging. Tagging must +conform to the rules established in the DTD (see ). + + +Style +SGML does not standardize style or other processing methods for +information stored in SGML.
+ +Resources +
+Conferences, tutorials, and training + +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. +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. + +
+
+
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 @@ + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + +]> + +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 + + 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 = ""; + + final String TEXT = " some text\n"; + XML_OUTPUT_FACTORY.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE); + + final String EXPECTED_OUTPUT = ""; + 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 = "" + "" + + "" + ""; + + 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 = ""; + 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 = "" + "" + "" + "requires no fixup" + "" + ""; + + 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 = "" + "" + "" + + "generate xmlns:prefix" + "" + ""; + + 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 = "" + "" + "" + + "not necessary to generate a declaration" + "" + ""; + + 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 = "" + "" + "" + "generate xmlns" + + "" + ""; + + 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 = "" + "" + "requires no fixup" + ""; + + 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 = "" + "" + + "generate xmlns:p=\"http://example.org/myURI\"" + ""; + + 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 = "" + "" + + "not necessary to generate a declaration" + ""; + + 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 = "" + + "" + + "generate xmlns declaration {generated prefix}=\"http://example.org/myURI\"" + ""; + + 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 = "" + "" + + "no prefix generation" + ""; + + 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 = "" + "" + "" + + "generate xmlns=\"\"" + "" + ""; + + 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 = "" + "" + + "" + "generate xmlns:p=\"http://example.org/myURI\"" + "" + ""; + + 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 = "" + "" + "" + "not necessary to generate a declaration" + "" + "
"; + + 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 = "" + "" + + "" + "generate xmlns=\"http://example.org/myURI\"" + "" + ""; + + 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 = "" + "" + "requires no fixup" + + ""; + + 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 = "" + + "" + + "generate xmlns:p=\"http://example.org/myURI\"" + ""; + + 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 = "" + + "" + + "not necessary to generate a declaration" + ""; + + 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 = "" + "" + "requires no fixup" + + ""; + final String EXPECTED_OUTPUT_2 = "" + + "" + "requires no fixup" + + ""; + + 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 = "" + "" + + "generate xmlns declaration {generated prefix}=\"http://example.org/myURI\"" + ""; + + 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 = "" + "" + "no prefix needs to be assigned" + ""; + + 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 = "" + "" + + " xmlns:{generated prefix}=\"http://example.org/URI-TWO\"" + " {generated prefix}:attr2=\"value\">" + + "remap xmlns declaration {generated prefix}=\"http://example.org/URI-TWO\"" + ""; + + 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 = "" + "" + "" + "" + ""; + + // 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 = "" + "" + ""; + + // 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 = "" + "" + "" + + "xmlns declaration =\"http://example.org/URI-TWO\"" + ""; + + // 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 = "" + "" + "never requires fixup" + ""; + + 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 = "" + "" + "never requires fixup" + + ""; + + 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. + */ + @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 = "" + "" + "" + ""; + 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 = "" + "" + ""; + 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 = "" + "" + "" + ""; + 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 = "" + "" + "" + ""; + 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 = "" + "" + "" + ""; + 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 = "" + "" + "" + ""; + 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 = "" + "" + + "" + ""; + 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 = "" + "" + "" + + "" + "" + ""; + 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 = "" + "" + ""; + 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 = "" + "" + ""; + 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 = "" + "" + ""; + 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 = "" + "" + ""; + 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 = "" + "" + + "" + ""; + + 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 + // + 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 + // + 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 + // + 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 = "java.sun.com"; + 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 @@ + + + + + 2006-07-20T22:57:12Z + 2006-07-20T23:02:12Z + + + + + + + principal + + urn:oasis:names:tc:SAML:1.0:cm:holder-of-key + + + + + + Xeg55vRyK3ZhAEhEf+YT0z986L0= + + + sPVCOcRVBGYDmnBAjnxoe5LfqAumazmxygPnFbSxGL35e90e1KurbODwNj5fmHxz9CkwAf8VQL8U + ESF3jDRbew4EbdE726uRFKGhK8Xt5G3Mzwo8PCxIcLKmxwwJYc3tpXaE94x937YLzv+Rp6i+sfPe + 7aNcDTMuQUmmDMujQcM= + + value + + + + + + + + + + +6+meGLSaVyDUa0jzlDJaRTyuCI= + X0kmFj+HnmVgC71G69wsfSHS7bQ2E+bFl0lLg7McFAcQW8GVFv/ekHpctySndRPLVFiu1AnRcPM5 + t/uRwQmbov6T0lJwP09rcgxwPVKPVycFHM8HLNOFA5L2MNpqGuKDSOyOXLDqba32BTxLGFyaJzCx + M/mH3WaZgiRDkWaeYUw= + + + G9QGBPj/Lnv/Km4FCTiqMg1xamk= + + + + uuid-96df98ce-5d8e-4855-a4ab-3232ca88e6df + + 0 + 24 + 1NJRlYY/gA54WTvInE3VuJ13 + + + + + + NQM0IBvuplAtETQvk+6gn8C13wE= + + + + NHjIM/BMwNP+XSrgyCE1MKYxwNoqSMX5WEVxABsyUzveDJr8kEmYdlXE4GiWsnJpuxHrYm +437yIq + Qjn/xR9TZI/iOvrM+f1JkeLBRtvl83ZrB6tfEIhH+hXUeOddx+LX0uQAIsamJL+chNS4V4inojsE + 00uFjPnq8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xIyyTFV2a89+M4OC12furqHlSwA439fCEeuxXZggWDq4NNKRQnwB0kSOm3kER0 + X2xepHxXzahbjTcAVmH9phDW/1Epq8hN6dssslrz3jqRrQO8PmQ6AvxHkPfXjpwHbZf8KjQSeck6 + x8+a8m09AmN79baCisysWT2M6NVJyTrfo1jqfFzSW8azHaMSACMO0bLu0Oco471xmA048KF+gFzg + bAyDKWHpvYm4wS2Qi+ciH1cgMyxXklkiL4pQySmOWLRKs3K7FAyF+5k8mqsrYSLiHtdqFhd1wj+v + axcD5vCWEPpy/fD336A27jZKs7hlKrScIxbGEPecVcuzzXYgQOFHV9GMUkNeTUOpvZs0ybVeNGky + vrlA3/groJS8Dc2uEv1LJQ1Z+r1dvh57qHMAHVeozL1sEQtVMp7kjT00BHmd56mcvF4PFc1wGR9T + Og0X31UzSGI2+LrnJNyM9llLaCdP3hbP8BokcsWKBuIppOGbs5JtfN0745txQ/ULPMH5izc6z6Tf + f7W2Q7RW9mbXI+dQ0hTwYWZBEgoqeLFlkR3IzBcr53Ci4eoxYPMZhgDnwjV6DPs= + + + + + + + + + + + + + + + + cHmTDN6hwJkJ7ZQ4K5jfDBX2EAg= + + + eUX07YDVpq71fQ43a+dqq3Te+V0= + + + + + + + + http +://131.107.72.15/Security_Federation_FederatedService_Indigo/Symmetric.svc/Scenario_6_IssuedTokenFor +CertificateSecureConversation_MutualCertificate11 + uuid:85e2ee55-ad08-4f23-9146-de477243f284 + +
http://www.w3.org/2005/08/addressing/anonymous
+
+ +http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT +
+ + + + + + + + + + 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== + + + +
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 @@ +FrobnosticationMoved tohere + 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 @@ +FrobnosticationMoved tohere + 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 @@ +TestCharacterData + 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 @@ + + 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 @@ +FrobnosticationMoved tohere + 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 @@ +FrobnosticationMoved tohere + 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 @@ + + 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 @@ + + + + + +
+ + + Please choose News, Weather, or Sports. + + + + [ news weather sports ] + + + + + + Form is being submited. + +
+ +
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 @@ + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + +]> + +Getting started with SGML + +The business challenge + +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. +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. + + +Getting to know SGML + +While SGML is a fairly recent technology, the use of +markup in computer-generated documents has existed for a +while. +
+What is markup, or everything you always wanted to know about +document preparation but were afraid to ask? + +Markup is everything in a document that is not content. The +traditional meaning of markup is the manual marking 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 procedural markup. + +Procedural markup +Most electronic publishing systems today use some form of +procedural markup. Procedural markup codes are good for one +presentation of the information. + +Generic markup +Generic markup (also known as descriptive markup) describes the +purpose 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. + +Drawbacks of procedural markup +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.
+
+What <emph>is</emph> SGML in the grand scheme of the universe, anyway? + +SGML defines a strict markup scheme with a syntax for defining +document data elements and an overall framework for marking up +documents. +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.
+
+How is SGML and would you recommend it to your grandmother? + +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. + +Structure +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. +A database schema also defines the relationships between the +various types of data. Similarly, a DTD specifies rules +to help ensure documents have a consistent, logical structure. + +Content +Content is the information itself. The method for identifying +the information and its meaning within this framework is called +tagging. Tagging must +conform to the rules established in the DTD (see ). + + +Style +SGML does not standardize style or other processing methods for +information stored in SGML.
+ +Resources +
+Conferences, tutorials, and training + +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. +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. + +
+
+
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 @@ + + +Getting started with SGML + +The business challenge + +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. +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. + + +Getting to know SGML + +While SGML is a fairly recent technology, the use of +markup in computer-generated documents has existed for a +while. +
+What is markup, or everything you always wanted to know about +document preparation but were afraid to ask? + +Markup is everything in a document that is not content. The +traditional meaning of markup is the manual marking 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 procedural markup. + +Procedural markup +Most electronic publishing systems today use some form of +procedural markup. Procedural markup codes are good for one +presentation of the information. + +Generic markup +Generic markup (also known as descriptive markup) describes the +purpose 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. + +Drawbacks of procedural markup +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.
+
+What <emph>is</emph> SGML in the grand scheme of the universe, anyway? + +SGML defines a strict markup scheme with a syntax for defining +document data elements and an overall framework for marking up +documents. +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.
+
+How is SGML and would you recommend it to your grandmother? + +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. + +Structure +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. +A database schema also defines the relationships between the +various types of data. Similarly, a DTD specifies rules +to help ensure documents have a consistent, logical structure. + +Content +Content is the information itself. The method for identifying +the information and its meaning within this framework is called +tagging. Tagging must +conform to the rules established in the DTD (see ). + + +Style +SGML does not standardize style or other processing methods for +information stored in SGML.
+ +Resources +
+Conferences, tutorials, and training + +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. +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. + +
+
+
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 @@ + +]> + +Getting started with SGML + +The business challenge + +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. +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. + + +Getting to know SGML + +While SGML is a fairly recent technology, the use of +markup in computer-generated documents has existed for a +while. +
+What is markup, or everything you always wanted to know about +document preparation but were afraid to ask? + +Markup is everything in a document that is not content. The +traditional meaning of markup is the manual marking 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 procedural markup. + +Procedural markup +Most electronic publishing systems today use some form of +procedural markup. Procedural markup codes are good for one +presentation of the information. + +Generic markup +Generic markup (also known as descriptive markup) describes the +purpose 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. + +Drawbacks of procedural markup +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.
+
+What <emph>is</emph> SGML in the grand scheme of the universe, anyway? + +SGML defines a strict markup scheme with a syntax for defining +document data elements and an overall framework for marking up +documents. +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.
+
+How is SGML and would you recommend it to your grandmother? + +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. + +Structure +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. +A database schema also defines the relationships between the +various types of data. Similarly, a DTD specifies rules +to help ensure documents have a consistent, logical structure. + +Content +Content is the information itself. The method for identifying +the information and its meaning within this framework is called +tagging. Tagging must +conform to the rules established in the DTD (see ). + + +Style +SGML does not standardize style or other processing methods for +information stored in SGML.
+ +Resources +
+Conferences, tutorials, and training + +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. +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. + +
+
+
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 @@ + + + + content text + Hello]]> + other content + + 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 @@ + + + content text + Hello]]> + other content + + 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 @@ + + + +content text + Hello]]> + other content + + 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 @@ + + + + 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 @@ + + + + + + Lego-Model01 + 65.99 + + + Lego-Model2 + 69.99 + + + Lego-Model3 + 14.99 + + + Barbie-Pink + 12.99 + + + Barbie-Blue + 13.99 + + + Barbie-White + 13.99 + + + Barbie-Plain + 13.99 + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + +5368141 +AEX%06ATLANTICSUN-SKED +Statistics +CBASK +2006-2007 Atlantic Sun Basketball Schedule/Results + + +Nov 13-L at UNC-Wilmington, 83-88 +Nov 14-W vs. Fordham, 56-49 +Nov 18-W at IUPUI, 67-61 +Nov 20-W vs. Fisk, 83-54 +Nov 27-L at Middle Tennessee, 57-64 +Nov 30-W vs. North Florida, 87-32 +Dec 2-W vs. Jacksonville, 76-62 +Dec 4-W vs. IUPUI, 76-66 +Dec 13-W at Ark-Little Rock, 72-57 +Dec 17-L at Illinois, 51-77 +Dec 19-L at Michigan State, 58-67 +Dec 28-W at Rice, 87-85 +Dec 29-L at St Marys-CA, 60-71 +Jan 2-W at East Tenn St, 75-74 OT +Jan 4-W at Kennesaw St, 63-45 +Jan 7-W vs. Mercer, 72-47 +Jan 9-W vs. Stetson, 73-71 +Jan 12-L vs. Lipscomb, 50-55 +Jan 18- at Campbell, 7:00 PM +Jan 20- at Gardner-Webb, 6:00 PM +Jan 25- vs. East Tenn St, 7:00 PM +Jan 27- vs. Kennesaw St, 7:00 PM +Feb 1- at Stetson, 6:00 PM +Feb 3- at Mercer, 6:00 PM +Feb 9- at Lipscomb, 6:30 PM +Feb 15- vs. Gardner-Webb, 7:00 PM +Feb 17- vs. Campbell, 7:30 PM +Feb 22- at Jacksonville, 6:00 PM +Feb 24- at North Florida, 7:00 PM + + +Nov 11-W vs. UNC-Pembroke, 106-66 +Nov 16-W vs. Coastal Carolina, 83-63 +Nov 20-W vs. UNC-Wilmington, 100-94 +Nov 25-L at Radford, 80-87 +Nov 27-L at Appalachian St, 71-84 +Dec 12-L at San Diego St, 82-119 +Dec 14-L at San Diego, 69-81 +Dec 18-W vs. Radford, 101-88 +Dec 23-L at Virginia Tech, 70-94 +Dec 30-W vs. Ohio Valley, 107-65 +Jan 2-W at North Florida, 78-48 +Jan 4-L at Jacksonville, 71-90 +Jan 6-W vs. Kennesaw St, 88-85 2OT +Jan 9-L vs. East Tenn St, 76-100 +Jan 13-L at Mercer, 93-94 +Jan 15-L at Stetson, 73-82 +Jan 18- vs. Belmont, 7:00 PM +Jan 20- vs. Lipscomb, 1:00 PM +Jan 25- vs. North Florida, 8:00 PM +Jan 27- vs. Jacksonville, 4:00 PM +Jan 30- at Gardner-Webb, 7:00 PM +Feb 2- at Kennesaw St, 7:30 PM +Feb 5- at East Tenn St, 7:00 PM +Feb 8- vs. Stetson, 7:00 PM +Feb 10- vs. Mercer, 7:00 PM +Feb 15- at Lipscomb, 8:00 PM +Feb 17- at Belmont, 7:30 PM +Feb 22- vs. Longwood, 7:00 PM +Feb 24- vs. Gardner-Webb, 6:00 PM + + +Nov 10-W vs. Virginia-Wise, 90-43 +Nov 13-L at Eastern Ky, 53-70 +Nov 15-W vs. Chattanooga, 71-70 OT +Nov 19-L at Auburn, 58-64 +Nov 21-L at Morehead State, 56-77 +Nov 24-L vs. Sam Houston St, 61-72 +Nov 25-W at Southern U, 66-52 +Nov 30-W at Mercer, 76-70 +Dec 2-W at Stetson, 75-61 +Dec 5-L at Vanderbilt, 62-104 +Dec 9-W vs. Milligan, 73-47 +Dec 19-W vs. UNC-Asheville, 73-65 +Dec 21-W vs. Radford, 71-51 +Dec 30-L at Tennessee, 88-93 +Jan 2-L vs. Belmont, 74-75 OT +Jan 4-W vs. Lipscomb, 75-72 OT +Jan 7-W at Gardner-Webb, 66-63 +Jan 9-W at Campbell, 100-76 +Jan 13-W vs. North Florida, 77-58 +Jan 15-W vs. Jacksonville, 71-59 +Jan 19- vs. Kennesaw St, 7:30 PM +Jan 25- at Belmont, 7:00 PM +Jan 27- at Lipscomb, 5:00 PM +Feb 2- vs. Gardner-Webb, 7:00 PM +Feb 5- vs. Campbell, 7:00 PM +Feb 8- at Jacksonville, 7:00 PM +Feb 10- at North Florida, 4:00 PM +Feb 17- at Kennesaw St, 7:30 PM +Feb 23- vs. Stetson, 7:30 PM +Feb 25- vs. Mercer, 2:00 PM + + +Nov 13-L at Texas Tech, 74-86 +Nov 14-L vs. Akron, 61-89 +Nov 19-L at North Carolina, 50-103 +Nov 21-L vs. UNC Greensboro, 67-79 +Nov 24-L at NC State, 76-88 +Nov 29-W vs. Ferrum, 70-53 +Dec 5-L at Georgia, 67-96 +Dec 9-W vs. Western Carolina, 74-73 O +Dec 16-L at High Point, 51-65 +Dec 19-L at Wake Forest, 60-92 +Dec 27-L at Wisconsin, 40-98 +Jan 2-L at Jacksonville, 64-73 +Jan 4-W at North Florida, 72-52 +Jan 7-L vs. East Tenn St, 63-66 +Jan 10-L vs. Kennesaw St, 60-77 +Jan 13-W at Stetson, 77-64 +Jan 15-L at Mercer, 74-85 +Jan 18- vs. Lipscomb, 7:00 PM +Jan 20- vs. Belmont, 6:00 PM +Jan 25- vs. Jacksonville, 6:00 PM +Jan 27- vs. North Florida, 8:15 PM +Jan 30- vs. Campbell, 7:00 PM +Feb 2- at East Tenn St, 7:00 PM +Feb 4- at Kennesaw St, 2:00 PM +Feb 8- vs. Mercer, 7:00 PM +Feb 10- vs. Stetson, 7:00 PM +Feb 15- at Belmont, 7:00 PM +Feb 17- at Lipscomb, 3:00 PM +Feb 24- at Campbell, 6:00 PM + + +Nov 12-L at Savannah State, 64-67 +Nov 14-W vs. Saint Leo, 77-73 +Nov 16-L at Florida, 61-90 +Nov 22-W vs. Florida Tech, 89-60 +Nov 25-W vs. SC State, 87-74 +Nov 27-L at U-C-F, 62-99 +Nov 30-L at Lipscomb, 61-73 +Dec 2-L at Belmont, 62-76 +Dec 10-W vs. Coastal Carolina, 85-72 +Dec 16-L at Texas A&M, 58-97 +Dec 19-L at Georgia, 77-93 +Dec 29-L at South Carolina, 73-80 +Jan 2-W vs. Gardner-Webb, 73-64 +Jan 4-W vs. Campbell, 90-71 +Jan 9-W at North Florida, 64-60 +Jan 13-L at Kennesaw St, 76-83 +Jan 15-L at East Tenn St, 59-71 +Jan 18- vs. Mercer, 7:00 PM +Jan 20- vs. Stetson, 7:00 PM +Jan 25- at Gardner-Webb, 6:00 PM +Jan 27- at Campbell, 4:00 PM +Feb 3- vs. North Florida, 6:00 PM +Feb 8- vs. East Tenn St, 7:00 PM +Feb 10- vs. Kennesaw St, 7:00 PM +Feb 16- at Mercer, 7:30 PM +Feb 18- at Stetson, 5:00 PM +Feb 22- vs. Belmont, 6:00 PM +Feb 24- vs. Lipscomb, 6:00 PM + + + + + +Nov 11-L vs. Western Ky, 55-96 +Nov 17-W at St Peters, 67-60 +Nov 18-L at Columbia, 51-63 +Nov 21-L vs. George Washington, 52-69 +Nov 25-L vs. Florida Intl, 68-70 +Nov 28-W vs. Newberry, 68-55 +Nov 30-L at Stetson, 56-61 +Dec 2-L at Mercer, 77-84 OT +Dec 17-L at Kansas State, 54-82 +Dec 19-L at Wichita State, 65-74 +Dec 22-W at MD-Eastern Shore, 67-49 +Dec 23-L at Longwood, 85-87 OT +Dec 29-L at Chattanooga, 67-83 +Dec 30-W vs. Alabama State, 78-72 +Jan 2-W vs. Lipscomb, 66-55 +Jan 4-L vs. Belmont, 45-63 +Jan 6-L at Campbell, 85-88 2OT +Jan 10-W at Gardner-Webb, 77-60 +Jan 13-W vs. Jacksonville, 83-76 +Jan 15-W vs. North Florida, 77-57 +Jan 19- at East Tenn St, 7:30 PM +Jan 25- at Lipscomb, 8:00 PM +Jan 27- at Belmont, 7:00 PM +Feb 2- vs. Campbell, 7:30 PM +Feb 4- vs. Gardner-Webb, 2:00 PM +Feb 8- at North Florida, 7:00 PM +Feb 10- at Jacksonville, 7:00 PM +Feb 14- at Georgia, 7:30 PM +Feb 17- vs. East Tenn St, 7:30 PM +Feb 22- vs. Mercer, 7:30 PM +Feb 24- vs. Stetson, 2:00 PM + + +Nov 11-W vs. Tusculum, 70-67 +Nov 13-W vs. Evansville, 67-64 +Nov 16-L at Missouri, 69-89 +Nov 19-L at South Carolina, 68-75 +Nov 25-W vs. Fisk, 80-68 +Nov 27-W vs. Winston-Salem St, 62-46 +Nov 30-W vs. Jacksonville, 73-61 +Dec 2-W vs. North Florida, 68-54 +Dec 7-L at Vanderbilt, 50-59 +Dec 14-W vs. Nicholls State, 75-55 +Dec 16-L at Evansville, 73-80 +Dec 21-W at Liberty, 66-61 +Dec 29-L at Alabama, 58-80 +Jan 2-L at Kennesaw St, 55-66 +Jan 4-L at East Tenn St, 72-75 OT +Jan 7-W vs. Stetson, 79-68 +Jan 9-W vs. Mercer, 89-68 +Jan 12-W at Belmont, 55-50 +Jan 18- at Gardner-Webb, 7:00 PM +Jan 20- at Campbell, 1:00 PM +Jan 25- vs. Kennesaw St, 8:00 PM +Jan 27- vs. East Tenn St, 5:00 PM +Feb 1- at Mercer, 7:00 PM +Feb 3- at Stetson, 7:00 PM +Feb 9- vs. Belmont, 6:30 PM +Feb 15- vs. Campbell, 8:00 PM +Feb 17- vs. Gardner-Webb, 3:00 PM +Feb 22- at North Florida, 7:00 PM +Feb 24- at Jacksonville, 6:00 PM + + +Nov 12-L at Wisconsin, 48-72 +Nov 14-L at Savannah State, 61-71 +Nov 18-W vs. Emory, 89-71 +Nov 27-L vs. Ga Southern, 59-61 +Nov 30-L vs. East Tenn St, 70-76 +Dec 2-W vs. Kennesaw St, 84-77 OT +Dec 4-W vs. Char Southern, 78-59 +Dec 7-W vs. Fort Valley St, 79-74 +Dec 9-W at Va Military, 105-103 +Dec 21-L at Oregon State, 62-93 +Dec 23-L at Oregon, 64-84 +Dec 30-L at Furman, 69-83 +Jan 2-W vs. Stetson, 84-63 +Jan 7-L at Belmont, 47-72 +Jan 9-L at Lipscomb, 68-89 +Jan 13-W vs. Campbell, 94-93 +Jan 15-W vs. Gardner-Webb, 85-74 +Jan 18- at Jacksonville, 7:00 PM +Jan 20- at North Florida, 4:00 PM +Jan 24- vs. Savannah State, 7:00 PM +Jan 26- at Stetson, 7:30 PM +Feb 1- vs. Lipscomb, 7:00 PM +Feb 3- vs. Belmont, 6:00 PM +Feb 8- at Gardner-Webb, 7:00 PM +Feb 10- at Campbell, 7:00 PM +Feb 16- vs. Jacksonville, 7:30 PM +Feb 18- vs. North Florida, 2:00 PM +Feb 22- at Kennesaw St, 7:30 PM +Feb 25- at East Tenn St, 2:00 PM + + +Nov 10-L at St Johns, 53-74 +Nov 11-L vs. Loyola-Maryland, 50-65 +Nov 14-L at Florida, 40-86 +Nov 19-W vs. Concordia (NY), 77-72 +Nov 22-L vs. Fla Atlantic, 44-59 +Nov 25-L at Northwestern, 39-40 +Nov 30-L at Belmont, 32-87 +Dec 2-L at Lipscomb, 54-68 +Dec 8-L at William & Mary, 44-61 +Dec 18-L vs. Binghamton, 61-79 +Dec 20-L vs. Florida A&M, 65-66 +Dec 28-W vs. Skidmore, 70-43 +Jan 2-L vs. Campbell, 48-78 +Jan 4-L vs. Gardner-Webb, 52-72 +Jan 9-L vs. Jacksonville, 60-64 +Jan 13-L at East Tenn St, 58-77 +Jan 15-L at Kennesaw St, 57-77 +Jan 18- vs. Stetson, 7:00 PM +Jan 20- vs. Mercer, 4:00 PM +Jan 25- at Campbell, 8:00 PM +Jan 27- at Gardner-Webb, 8:15 PM +Jan 30- at Savannah State, 7:00 PM +Feb 3- at Jacksonville, 6:00 PM +Feb 8- vs. Kennesaw St, 7:00 PM +Feb 10- vs. East Tenn St, 4:00 PM +Feb 15- at Stetson, 7:00 PM +Feb 18- at Mercer, 2:00 PM +Feb 22- vs. Lipscomb, 7:00 PM +Feb 24- vs. Belmont, 7:00 PM + + + +Nov 10-L at Army, 68-80 +Nov 11-W at NC A&T, 72-69 +Nov 12-L at Missouri, 45-66 +Nov 18-L at U-C-F, 60-73 +Nov 20-W vs. Palm Beach Atlantic, 80-6 +Nov 27-L at South Florida, 72-77 2OT +Nov 30-W vs. Kennesaw St, 61-56 +Dec 2-L vs. East Tenn St, 61-75 +Dec 5-L vs. Florida State, 63-82 +Dec 16-L at Miami-Florida, 64-89 +Dec 20-L at Florida, 67-88 +Dec 23-W at Savannah State, 58-46 +Dec 30-W vs. Skidmore, 85-55 +Jan 2-L at Mercer, 63-84 +Jan 7-L at Lipscomb, 68-79 +Jan 9-L at Belmont, 71-73 +Jan 13-L vs. Gardner-Webb, 64-77 +Jan 15-W vs. Campbell, 82-73 +Jan 18- at North Florida, 7:00 PM +Jan 20- at Jacksonville, 7:00 PM +Jan 26- vs. Mercer, 7:30 PM +Feb 1- vs. Belmont, 6:00 PM +Feb 3- vs. Lipscomb, 7:00 PM +Feb 8- at Campbell, 7:00 PM +Feb 10- at Gardner-Webb, 7:00 PM +Feb 13- vs. Savannah State, 7:00 PM +Feb 15- vs. North Florida, 7:00 PM +Feb 18- vs. Jacksonville, 5:00 PM +Feb 23- at East Tenn St, 7:30 PM +Feb 24- at Kennesaw St, 2:00 PM + + + January 18, 2007, at 03:41 AM ET + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + +10016 +Wed May 29 12:45:00 PDT 2002 + +ABC +XYZ +1234 Anywhere Street +Palo Alto +California +USA +94303 +NULL +NULL + + + + + \ 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 @@ + + + +10016 +Wed May 29 12:45:00 PDT 2002 + +ABC +XYZ +1234 Anywhere Street +Palo Alto +California +USA +94303 +NULL +NULL + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + +10016 +Wed May 29 12:45:00 PDT 2002 + +ABC +XYZ +1234 Anywhere Street +Palo Alto +California +USA +94303 +NULL +NULL + + + + + 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 @@ + + + + + + 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("0")); + } 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 @@ + + + + + + + + + + + + + +]> + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + +]> + + + + + + + + + + + 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(""); + 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 = "" + + "" + "" + "" + "" + "" + + ""; + + @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 = "\n" + + "\n" + + "\n" + "\n" + "\n" + + "soapenv:Server\n" + "\n" + "com.sun.ts.tests.jaxws.sharedwebservices.faultservice.DummyException\n" + + "\n" + "\n" + "\n" + "dummyString1\n" + "\n" + "dummyString2\n" + + "\n" + "\n" + "\n" + "\n" + "\n"; + + // simplest XML to re-declare same prefix/namespace mappings + private static final String SIMPLE_TESTXML = "\n" + "\n" + + "\n" + "\n" + "\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 = ""; + 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 = ""; + 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 = "\n" + "\n" + + " Hello World!\n" + "\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 = "" + "" + "

Test

"; + + 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 = "" + ""; + + 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("&")); + } 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 @@ + +1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 init_01_InitialDummyMOSMESNNinit_02_InitialDummyXid_4dd1acc6337e11d0e10080000ab5dd78init_03_InitialDummyid_4dd1ad48337e11d0e10080000ab5dd78id_4dd1ad8a337e11d0e10080000ab5dd78id_4dd1add2337e11d0e10080000ab5dd78id_4dd1ae1a337e11d0e10080000ab5dd78init_04_InitialDummyid_4dd1af06337e11d0e10080000ab5dd78id_4dd1af58337e11d0e10080000ab5dd78init_05_InitialDummyid_4dd1b05d337e11d0e10080000ab5dd78id_4dd1b0b9337e11d0e10080000ab5dd78init_06_InitialDummyid_4dd1b1da337e11d0e10080000ab5dd78id_4dd1b240337e11d0e10080000ab5dd78init_07_InitialDummyid_4dd1b320337e11d0e10080000ab5dd78id_4dd1b390337e11d0e10080000ab5dd78init_09_InitialDummyid_4dd225b0770407c0e10080000ab5dd78id_4dd2262e770407c0e10080000ab5dd78id_4dd226af770407c0e10080000ab5dd78init_10_InitialDummyid_4dd2280f770407c0e10080000ab5dd78id_4dd20ac184ef12e0e10080000ab5dd78init_11_InitialDummyid_4dd2240285141030e10080000ab5dd78id_4dd2250885141030e10080000ab5dd78init_12_InitialDummyid_4dd2271585141030e10080000ab5dd78id_4dd2281485141030e10080000ab5dd78init_14_InitialDummyid_4dd22d8585141030e10080000ab5dd78id_4dd22e9685141030e10080000ab5dd78init_15_InitialDummyid_4dd231ea85141030e10080000ab5dd78id_4dd2331685141030e10080000ab5dd78init_16_InitialDummyid_4dd2367685141030e10080000ab5dd78id_4dd2379b85141030e10080000ab5dd78init_17_InitialDummyid_4dd23b1f85141030e10080000ab5dd78id_4dd23c5f85141030e10080000ab5dd78init_18_InitialDummyid_4dd20e5685071800e10080000ab5dd78id_4dd20f8f85071800e10080000ab5dd78init_19_InitialDummyid_4dd2134985071800e10080000ab5dd78id_4dd2148c85071800e10080000ab5dd78id_4dd215d285071800e10080000ab5dd78id_4dd2172285071800e10080000ab5dd78id_4dd2186e85071800e10080000ab5dd78init_20_InitialDummyid_4dd21c6385071800e10080000ab5dd78id_4dd21db985071800e10080000ab5dd78id_4dd21f1285071800e10080000ab5dd78id_4dd2206e85071800e10080000ab5dd78id_4dd221cd85071800e10080000ab5dd78id_4dd2232f85071800e10080000ab5dd78id_4dd2249485071800e10080000ab5dd78init_21_InitialDummyid_4dd228d085071800e10080000ab5dd78id_4dd22a3f85071800e10080000ab5dd78id_4dd22bb185071800e10080000ab5dd78id_4dd209ce85141030e10080000ab5dd78CUSTOMER_WISHDEALER_WISHid_4dd20ced85141030e10080000ab5dd78YNid_4dd112db55800ff0e10080000ab5dd78YNid_4dd114c155800ff0e10080000ab5dd78TEL_CUSTOMERTEL_DEALERTECHNICIANORDERinit_01_InitialDummyinit_02_InitialDummyinit_03_InitialDummyinit_04_InitialDummyinit_05_InitialDummyinit_06_InitialDummyinit_07_InitialDummyinit_09_InitialDummyinit_10_InitialDummyinit_11_InitialDummyinit_12_InitialDummyinit_14_InitialDummyinit_15_InitialDummyinit_16_InitialDummyinit_17_InitialDummyinit_18_InitialDummyinit_19_InitialDummyinit_20_InitialDummyinit_21_InitialDummyid_4dd209ce85141030e10080000ab5dd78id_4dd20ced85141030e10080000ab5dd78id_4dd112db55800ff0e10080000ab5dd78id_4dd114c155800ff0e10080000ab5dd78 + 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 @@ + + + + + + Bitte geben Sie ein gültiges Datum ein! + Bitte geben Sie eine Zahl ein! + Bitte geben Sie eine gültige Uhrzeit ein! + Bitte machen Sie Eingaben in alle Mussfelder! + + <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> <!-- </xsl:text> + <xsl:apply-templates select="."/> + <xsl:text> //--></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"><BR></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">&#013;&#010;</xsl:variable><xsl:choose><xsl:when test="contains($sourceTextCRLF, $findCRLF)"><xsl:value-of select="substring-before($sourceTextCRLF,$findCRLF)"/> + <BR> + <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"><COMMENT></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 + + + 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 @@ + + + + +

+ + + +
+ + + +

MyTemplate has been called. param x=.

+
+ + +
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 @@ + + + + +

Dummy has been called.

+
+ +
+ 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 @@ +Data Objects +Data Fields +select all +select none +Choose Data Object +Choose Data Fields +More Options, or Finish +Next +Back +Finish +Apply +Sort Direction +View Fields +Sorted Fields +Ascending +Descending +OK +Cancel +Report Groups +Report Group +Report Fields +Group Properties +Display Group Header/Footer +Group Sort Direction +Group Type +Surface Prompts +Header +Footer +Display in +Row Filter +Group Filter +Summary Function(s) +Report Footer +Group Footer +Detail +Same Value +Choose Content Type +If you group by a field, you can only choose one Summary Function for one Chart Value. +You must select at least one summary function for each chart value. +Sum +Average +Minimum +Maximum +Count +Count Distinct +Group +Summary +Columns +rows +Values +Show intermediate summary functions +Summary Levels +Hide +Arrange +data object +You must click Add/Update Entry to apply the filter +Filter Entry +Crosstab Editor +Drag fields here to put the values on the row axis. +There must be at least one field in either rows or columns. +There must be at least one field selected for values. +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. +Fields +Sort +Data Objects +Actions +Editable Fields +Filter +Top N +Drilling +Calculation +Summary +Group +Driving +General +Content +Shading +Text +Align +Cond Format +Value Format +Data Labels +Font +Active Data +Axis +Content Type +Inputs +Associations +Gauge Styles +Themes +Background color +Collapse Edit Pane +Expand Edit Pane +Move Edit Pane +Display the Top N based on the first series of the chart +Display the Top N based on the sum of the series of the chart +Display the Top N based on the current sort criteria +Layout +Quantity +Add a field displaying the rank number +Field Name +Rank Field +Select Style +High Performance +Horizon +Medallion +Macro Options +Data Transfer +Run this macro before +Run this macro after +Name +Run on data transfer +Name definition for data +For Updating Ordered List views, apply a sort for Top N to display. +For Updating Ordered List views, apply a sort for Rank Colors to display. +View Editor +Summarize +You must choose an aggregate function to Summarize a List. +For Updating Ordered List views, a field must be selected in the Fields page if you want to sort on it. +Patterns +Cannot create a negative or zero grouped time bucket. +Cannot create time buckets with a non time based function. +is not a supported quantity for this time unit. \nSelect a quantity that divides evenly into +Cannot create a continuous time series with multiple groupings or units. +Target +Calculation +Percent Of Total +Tab Contents +Toolbar +Dashboard Contents +is not a supported quantity for Quarters. \nQuarters can only use a quantity of +You must group by the same number of fields for all Data Objects. +You must group by the same type of fields for all Data Objects. +Chart Data Fields +A field cannot be selected as an index and a measure. +Please select an Index +Please select a Measure +Please type in a Pass Filter +Index +SPC Chart Measures +3D View +Data +PropertiesTime Unit +Quantity +Time Groups +Year +Quarter +Month +Week +Day of Year +Day of Month +Day of Week +Hour +Minute +Second +Use time series +Continuous time series +Use time groupsbam_as_viewedit_doselect 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 @@ + + + + + + + 21 + + + + + + + + + StreamingList + UpdatesList + List + UpdatingOrderedList + + + General + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + ValueFormat + + + + Font + + + + ActiveData + + + + Driving + + + + CollapsedList + + + General + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + ValueFormat + + + + Font + + + + ActiveData + + + + Driving + + + + ActionList + + + General + + + + Actions + + + + EditableFields + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + ValueFormat + + + + Font + + + + ActiveData + + + + Driving + + + + OWCSpreadsheet + + + General + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + Font + + + + ActiveData + + + + ExcelSpreadsheet + + + General + + + + Macros + + + + DataTransfer + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + Font + + + + Columnar + + + General + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + ValueFormat + + + + Font + + + + ActiveData + + + + DialGauge + + + GeneralDial + + + + Styles + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + ValueFormat + + + + Font + + + + Arrow + MarketArrow + + + GeneralArrow + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + ValueFormat + + + + Font + + + + RangeGauge + + + GeneralRange + + + + Styles + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + ValueFormat + + + + Font + + + + + SurfacePrompts + + + General + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + Font + + + + SurfacePrompts + + + + + Container + + + General + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + Font + + + + Drilling + + + + + RowGroup + ColumnGroup + + + General + + + + Layout + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + Font + + + + + CustomContent + + + General + + + + ChooseContentType + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + Font + + + + + TabGroup + + + + + TabContents + + + + General + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + Font + + + + + Dashboard + + + + + DashboardContents + + + + + + DashboardToolbar + + + + General + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + Font + + + + + ActionForm + + + chooseActionFormType + + + + inputs + + + + associations + + + + General + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + Font + + + + + BarChart + LineChart + AreaChart + ComboChart + StackedBarChart + + + General + + + + Axis + + + + DataLabels + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + ValueFormat + + + + Themes + + + + Font + + + + ActiveData + + + + Patterns + + + + Target + + + + + ThreeDBarChart + ThreeDLineChart + ThreeDAreaChart + ThreeDComboChart + ThreeDStackedBarChart + + + General + + + + Axis + + + + DataLabels + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + ValueFormat + + + + Themes + + + + Font + + + + ActiveData + + + + Patterns + + + + Target + + + + 3DView + + + + + + + General + + + + DataLabels + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + ValueFormat + + + + Font + + + + + RChart + SChart + PChart + + + General + + + + Axis + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + ValueFormat + + + + Themes + + + + Font + + + + ActiveData + + + + PieChart + + + General + + + + DataLabels + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + ValueFormat + + + + Themes + + + + Font + + + + ActiveData + + + + Patterns + + + + ThreeDPieChart + + + General + + + + DataLabels + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + ValueFormat + + + + Themes + + + + Font + + + + ActiveData + + + + Patterns + + + + 3DView + + + + CrossTab + + + General + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + Font + + + + ValueFormat + + + + Themes + + + + ActiveData + + + + Driving + + + + + Matrix + + + General + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + Font + + + + ValueFormat + + + + ConditionalFormat + + + + Themes + + + + ActiveData + + + + Driving + + + + SummaryCrosstab + + + General + + + + BordersAndShading + + + + + & + + + TextAndAlignment + + + + Font + + + + ValueFormat + + + + ActiveData + + + + Driving + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataTabsScroller + + 2 + + + + + + + + + + + + + + + + + + + + + + + viewEditor.SelectTab(''); + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + +
+
+ + .OnResize(); + + + position:relative;overflow:hidden;width:100%;height:px; + +
+ + position:absolute;width:100%;left:0px;top:px; + + +
+
+
+
+ +
+ + + + + + UpdatingOrderedList + ActionList + + + datasets + + + + fields + + + + sort + + + + rowFilter + + + + topN + + + + calculations + + + + drilling + + + + surfacePrompts + + + + CollapsedList + List + OWCSpreadsheet + ExcelSpreadsheet + + + datasets + + + + fields + + + + sort + + + + rowFilter + + + + calculations + + + + drilling + + + + surfacePrompts + + + + StreamingList + UpdatesList + + + datasets + + + + fields + + + + rowFilter + + + + calculations + + + + drilling + + + + surfacePrompts + + + + CrossTab + + + datasets + + + + crosstabFields + + + + aggregate + + + + rowFilter + + + + calculations + + + + drilling + + + + surfacePrompts + + + + Matrix + + + datasets + + + + crosstabFields + + + + rowFilter + + + + drilling + + + + calculations + + + + surfacePrompts + + + + SummaryCrosstab + + + datasets + + + + crosstabFields + + + + aggregate + + + + rowFilter + + + + calculations + + + + drilling + + + + surfacePrompts + + + + Columnar + + + datasets + + + + fields + + + + group + + + + aggregate + + + + rowFilter + + + + calculations + + + + drilling + + + + StackedBarChart + LineChart + AreaChart + ComboChart + ThreeDStackedBarChart + ThreeDLineChart + ThreeDAreaChart + ThreeDComboChart + + + datasets + + + + chartFields + + + + rowFilter + + + + topN + + + + calculations + + + + drilling + + + + surfacePrompts + + + + RChart + SChart + PChart + + + datasets + + + + chartFields + + + + rowFilter + + + + calculations + + + + drilling + + + + surfacePrompts + + + + BarChart + ThreeDBarChart + + + datasets + + + + chartFields + + + + rowFilter + + + + topN + + + + calculations + + + + drilling + + + + surfacePrompts + + + + PieChart + ThreeDPieChart + + + + datasets + + + + chartFields + + + + rowFilter + + + + calculations + + + + drilling + + + + surfacePrompts + + + + Arrow + MarketArrow + RangeGauge + DialGauge + + + datasets + + + + kPIFields + + + + rowFilter + + + + calculations + + + + drilling + + + + surfacePrompts + + + + + +
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 @@ + + + + + + E3 + + + + + + + + + E3 + + + + + + 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 @@ + + + + + + + + + Working (by replacing the count() argument with a variable): + + + + + Node ; + + count = + + --------- + + Not working in the 2nd loop iteration (by using the union expression as count() argument): + + + + + + Node ; + + count = + + --------- + + + + + 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 @@ + + + + + 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 @@ + + + + + + + namevalue + packagevalue + + + + + + + + + + + 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 @@ + + + + + + +

+ 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 other pages around that cover XSLT. Jeni's XSLT Pages, though, are dedicated to helping people understand and make the most of using XSLT. +

+

+ My warmest thanks to all those people who post interesting problems on XSL-List, and especially to those of you that have encouraged me to set up this site through your kind emails. +

+ +
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 @@ + + + + + + + + + + + + + + + + + + + + + <xsl:call-template name="get-metadata"> + <xsl:with-param name="what" select="'title'" /> + <xsl:with-param name="about" select="$uri" /> + </xsl:call-template> + + + + + + + + + + + + + + + + + + + + + + +

+ + +

+
+ + + + + + + + + + /index.xml + + /index.html + + + + + + + + + + + + ../index.xml + ../index.html + + + + + index.xml + index.html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + +
+ $ + + + = + + + [= ] + + +
+
+ + +
    + +
+
+ +
+
+ + +
  • :
  • +
    + + + + + + + '' + "" + + + + + + + + + + + +
    + +
    +
    + + +
    + +
    +
    + + +
    +

    + + + + + + +

    + +
    +
    + + +
    +		
    +	
    +
    + + + + +
    +        
    +      
    +
    + + + + + +
    +
    + + + + + + + + + +
    + + + + + + + + + + + +
    + + + + + + + + + + + [] + + + + + + +
    + +
    + +
    + + + + + + + + + + + + + + resources/icons/ + click- + + .gif + + + javascript:this.src='resources/icons/over-.gif' + javascript:this.src='resources/icons/click-.gif' + javascript:this.src='resources/icons/.gif' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + img + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http:// + + + mailto: + + + + + + + + + offsite + mailto + local + + + + + + + + + + + + + home + mail + goto + + + + + + +
    +
    +

    + + + + + + + + last modified + + + + + + + + by + + + + + + Jeni Tennison + + +

    +
    +
    + +
    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("

    ") < 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 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 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 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 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 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 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 @@ +12 + 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 @@ + + + + + First: + Second: + Third: + + + 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 @@ + + + + + + + + + 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(" Stuff"); + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + x-symbol + + + + + swiss + + + modern + + + roman + + + script + + + decorative + + + system + + + system + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text + + + + + + + text + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + frame + + + page + + + as-char + + + paragraph + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + page + cm + cm + cm + cm + + + + + + + + + + + + + + + + + + + + + + + + + + page + cm + cm + cm + cm + + + + + + + + + + + + + List + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bullet Symbols + + + + Numbering Symbols + + + + + + + + + + + + Numbering Symbols + + + + + + + + + + + + + + end + + + center + + + start + + + + + + + + + + + + + + + 0 + + + + + + + + + 0cm + + + + 0.20cm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + middle + line + + cm + cm + + + + + + + + + + + + + 0 + + + + + + + + + 0cm + + + 0.20cm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + List + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + 0 + + + + + + + + + + + + + 1 + + + I + + + i + + + A + + + a + + + 一, 二, 三, ... + + + ア, イ, ウ, ... + + + イ, ロ, ハ, ... + + + 1, 2, 3, ... + + + 壱, 弐, 参, ... + + + ①, ②, ③, ... + + + ア, イ, ウ, ... + + + イ, ロ, ハ, ... + + + 가, 나, 다, ... + + + ㄱ, ㄴ, ㄷ, ... + + + 甲, 乙, 丙, ... + + + 子, 丑, 寅, ... + + + 壹, 貳, 參, ... + + + 壹, 贰, 叁, ... + + + 일, 이, 삼, ... + + + א, ב, ג, ... + + + أ, ب, ت, ... + + + ก, ข, ฃ, ... + + + Native Numbering + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + pm + + cm + cm + + + cm + cm + cm + + + cm + cm + cm + + + cm + cm + cm + + + cm + + + + + + + + + cm + + + + + + + + + + + + Standard + + + + + cm + 0.792cm + true + + + + + cm + 0.792cm + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + false + + true + + + + + + + 1 + 1 + + + 3 + + + 2 + + + 1 + + + 0 + + + + + + + + + + + + + + + + Table + table + + + + + + + + + + margins + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + 0 + + + + + + + + 0 + + + + + + + + + + + + + + TableFrame + graphics + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + no-limit + + + + + top + + + middle + + + bottom + + + from-top + + + top + + + from-top + + + + + + + + + + + + + + + + + + + + + + + + + + + + + left + + + center + + + right + + + from-left + + + outside + + + left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #ffffff + 100% + parallel + + + + + + + table-column + Table.C + + + + + + + + + + + + + + table-row + Table.R + + + + + + + + + + + + + + + + + Table.RC + table-cell + + + + + + + + + + + + + + + + + + + + + + top + + + middle + + + bottom + + + automatic + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + single + + + + + + hidden + solid + double + + + + + + + + + c0c0c0 + + + + + + c0c0c0 + + + + + + c0c0c0 + + 000000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.002cm 0.035cm 0.002cm + + + + 0.002cm 0.088cm 0.002cm + + + + 0.035cm 0.035cm 0.035cm + + + + 0.088cm 0.088cm 0.088cm + + + + + + + + 0.002cm 0.035cm 0.002cm + + + + .002cm 0.088cm 0.002cm + + + + 0.035cm 0.035cm 0.035cm + + + + 0.088cm 0.088cm 0.088cm + + + + + + + + + + 0.002cm 0.088cm 0.035cm + + + + 0.002cm 0.088cm 0.088cm + + + + 0.002cm 0.088cm 0.141cm + + + + + + 0.088cm 0.035cm 0.035cm + + + + + + + + 0.002cm 0.088cm 0.088cm + + + + 0.002cm 0.088cm 0.141cm + + + + 0.088cm 0.088cm 0.141cm + + + + + + + + 0.002cm 0.035cm 0.002cm + + + + 0.035cm 0.035cm 0.035cm + + + + + + 0.035cm 0.088cm 0.088cm + + + + 0.088cm 0.035cm 0.035cm + + + + + + + + 0.088cm 0.088cm 0.141cm + + + 0.141cm 0.088cm 0.088cm + + + + + + + + + + 0.002cm 0.035cm 0.002cm + + + + 0.035cm 0.035cm 0.035cm + + + + + + 0.088cm 0.035cm 0.035cm + + + + 0.035cm 0.088cm 0.088cm + + + + + + + + 0.141cm 0.088cm 0.088cm + + + 0.088cm 0.088cm 0.141cm + + + + + + + + + + 0.002cm 0.088cm 0.002cm + + + + + + 0.002cm 0.088cm 0.035cm + + + + 0.002cm 0.088cm 0.002cm + + + + + + + + 0.002cm 0.088cm 0.035cm + + + + 0.088cm 0.035cm 0.035cm + + + + + + + + 0.002cm 0.088cm 0.088cm + + + + 0.088cm 0.035cm 0.035cm + + + + + + + + 0.002cm 0.088cm 0.141cm + + + + 0.088cm 0.035cm 0.035cm + + + + + + + + 0.088cm 0.088cm 0.141cm + + + 0.141cm 0.088cm 0.088cm + + + + + + + + + + 0.002cm 0.088cm 0.035cm + + + + 0.002cm 0.088cm 0.088cm + + + + 0.002cm 0.088cm 0.141cm + + + + 0.088cm 0.088cm 0.141cm + + + + + + 0.035cm 0.035cm 0.035cm + + + + + + + + + + + + + + + 0.088cm 0.088cm 0.088cm + + + + 0.088cm 0.088cm 0.141cm + + + + + + + + 0.002cm 0.088cm 0.002cm + + + + + + 0.002cm 0.088cm 0.002cm + + + + 0.002cm 0.088cm 0.035cm + + + + + + + + 0.088cm 0.035cm 0.035cm + + + + 0.002cm 0.088cm 0.035cm + + + + + + + + 0.088cm 0.035cm 0.035cm + + + + 0.002cm 0.088cm 0.088cm + + + + + + + + 0.088cm 0.035cm 0.035cm + + + + 0.002cm 0.088cm 0.141cm + + + + + + + + 0.141cm 0.088cm 0.088cm + + + + 0.088cm 0.088cm 0.141cm + + + + + + + 0.002cm solid #000000 + + + + + + + + + + TableFrame + TableFr + + + + as-char + + + paragraph + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Table + + + + + + + + + + + + + Table + + + + + + + + + + + + Table.C + + + + + + + Table.R + + + + + + + Table.RC + + + + + + + + + + + + + + + + + + + + + Times New Roman + + + + pt + pt + + + pt + + + + 10pt + 10pt + 10pt + + + + + + + + + + + + + + + + cm + + + + + + + + + + + + + + + + + + + + + + + Standard + + + Standard1 + + + + + + + + + + + + + + Standard + + + Standard1 + + + + + + + + + + + + + + + Standard + + + Standard1 + + + + + + + + + + + cm + + + cm + + + cm + + + cm + + + + rl-tb + end + + + + + center + + + + + end + + + start + + + + + + + start + + + end + + + + + justify + false + + + + false + + + + cm + + + % + + + cm + + + + cm + + + cm + + + + + + + + + #000000 + + + + + + + + + + + + page + + + + + + cm + + + char + + + + + + + + -_. + + + + + hyphen + + + underscore + + + dot + + + middle-dot + + + + + + + + + true + + + avoid + + + 2 + 2 + + + false + + + normal + + + simple + + + none + + + + + middle + + + + + + + + + + + + + cm + + + + + + + cm + + + + + + + cm + + + + + + + cm + + + #000000 0.15cm 0.15cm + + + + false + + + + + + T + text + + + + + + + + + + + + + + + + + + + + + + + + + + + + bold + bold + + + bold + + + italic + italic + + + italic + + + uppercase + + + small-caps + + + single-line + + + double-line + + + true + + + 1pt 1pt + 1pt 1pt + + + engraved + + + embossed + + + true + + + # + + + cm + + + + + + + + 58% + 100% + + + + + + + + + super + sub + + + + + + pt + pt + + + pt + + + + + #000000 + + + #ffff00 + + + #00ff00 + + + #00ffff + + + #ff00ff + + + #0000ff + + + #ff0000 + + + #000080 + + + #008080 + + + #008000 + + + #800080 + + + #800000 + + + #808000 + + + #808080 + + + #c0c0c0 + + + + + + + single + false + + + bold + + + bold-dotted + + + bold-dash + + + long-dash + + + bold-long-dash + + + bold-dot-dash + + + bold-dot-dot-dash + + + bold-wave + + + double-wave + + + + + + + # + + + + true + #000000 + + + + # + + + + + + accent below + + + disc below + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text:h + text:p + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + T + + + + + + + + + + + + + + + + + + + + + + simple + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Microsoft Word 2003 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + measure_conversion.xsl: Find no conversion for to 'mm'! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + measure_conversion.xsl: Find no conversion for to 'cm'! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + measure_conversion.xsl: Find no conversion for to 'in'! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + measure_conversion.xsl: Find no conversion for to 'dpt'! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + measure_conversion.xsl: Find no conversion for to 'pica'! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + measure_conversion.xsl: Find no conversion for to 'pt'! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + measure_conversion.xsl: Find no conversion for to 'twip'! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + measure_conversion.xsl: Find no conversion for to 'px'! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + measure_conversion.xsl: Find no conversion for to 'twip'! + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + 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 @@ + + +0123 + 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 @@ + + + + + + + + + + + + + + | + + | + + | + + + + + 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 @@ + + + + + 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== + + + + + + + + + elU7zQXCWw3VUeb7CRRhm2Qc0HTF6tQz4MAaLDrlw60oBi0bHi2npe + vNuhQuDIMBcqA4U9f51zK7 + /tR8602YjpMETlby/w01yLGb2IvzKsFAL02NilRUT4o1Jj2PiLibcbVonzuye/ + dfoNKi5dNeQY6k + In3JurQmap8QEEpEoIM= + + + + + + + + + + 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= + + + + + + + + 97000.0 + 7000.0 + + + 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 @@ + + 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 @@ + + + + + + + + + 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 @@ + + + + + + E3 + + + + + + + + + E3 + + + + + + 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 @@ + + + + + + + + + Working (by replacing the count() argument with a variable): + + + + + Node ; + + count = + + --------- + + + Not working in the 2nd loop iteration (by using the union expression as count() argument): + + + + + + + Node ; + + + count = + + --------- + + + + + 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 = "" + + " " + " " + " " + + " " + " " + + " " + " " + " " + ""; + 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; + } + + /** + *

    + * Test stylesheets that import other stylesheets. + *

    + * + *

    + * Inspired by: CR 6236727-2125981 XSLTC never stops resolving imported + * stylesheets when outer stylesheet is a DOMSource + *

    + */ + @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 = "" + ""; + + //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 = "" + LINE_SEPARATOR + + "" + LINE_SEPARATOR + + "" + LINE_SEPARATOR + "" + LINE_SEPARATOR + + "" + LINE_SEPARATOR + " " + LINE_SEPARATOR + + " " + LINE_SEPARATOR + " " + LINE_SEPARATOR + + " " + LINE_SEPARATOR + " " + LINE_SEPARATOR + + " " + LINE_SEPARATOR + " " + LINE_SEPARATOR + " " + + LINE_SEPARATOR + " " + LINE_SEPARATOR + " " + LINE_SEPARATOR + "" + LINE_SEPARATOR + + "" + LINE_SEPARATOR + ""; + + final String sourceXml = "" + + LINE_SEPARATOR + // "" + LINE_SEPARATOR + + // "" + LINE_SEPARATOR + + // "" + LINE_SEPARATOR + + // "]>" + + // LINE_SEPARATOR + + + "" + LINE_SEPARATOR + " " + LINE_SEPARATOR + " Valeur 1" + LINE_SEPARATOR + + " " + LINE_SEPARATOR + " " + LINE_SEPARATOR + " Valeur 2" + LINE_SEPARATOR + + " " + LINE_SEPARATOR + ""; + + 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 @@ + + + + + + 21 + + + + + + + + + + + + + + + + + + + + + + + PieChart + ThreeDPieChart + + + + + datasets + + + + + + chartFields + + + + + 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 @@ + + + a + 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 @@ + + + + + + + + + + + + + + none + + + + + + underline + + + + black + + + + 14pt + + + 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 @@ + +<_test01><_test-04>T%e!s#t$
    1000509.90.0860833333333333345134545.22916666666667114.44-16.886.70A1Vn

    2000503.80.08438888888888889-003011-0.503055555555555698.33-61.146.29gG9

    3Psc33 Psc000520.10.08891666666666666-054227-5.707500000000000593.75-65.934.61K0IIIbCN-0.5

    4Peg86 Peg000542.00.09513234613.39611111111111106.19-47.985.51G5III

    5000616.00.1044444444444444558261258.43666666666666117.03-03.925.96G5V

    6000619.00.10527777777777779-490430-49.075321.61-66.385.70G1IV

    7Cas10 Cas000626.50.1073611111111111264114664.19611111111111118.061.755.59B9III

    8000636.80.1102222222222222229011729.02138888888889111.26-32.836.13K0V

    9000650.10.11391666666666667-230627-23.107552.21-79.146.18A7V

    10000718.20.12172222222222222-172311-17.38638888888888874.36-75.906.19A6Vn
    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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + +<_test01><_test-04>T%e!s#t$
    1000509.90.0860833333333333345134545.22916666666667114.44-16.886.70A1Vn

    2000503.80.08438888888888889-003011-0.503055555555555698.33-61.146.29gG9

    3Psc33 Psc000520.10.08891666666666666-054227-5.707500000000000593.75-65.934.61K0IIIbCN-0.5

    4Peg86 Peg000542.00.09513234613.39611111111111106.19-47.985.51G5III

    5000616.00.1044444444444444558261258.43666666666666117.03-03.925.96G5V

    6000619.00.10527777777777779-490430-49.075321.61-66.385.70G1IV

    7Cas10 Cas000626.50.1073611111111111264114664.19611111111111118.061.755.59B9III

    8000636.80.1102222222222222229011729.02138888888889111.26-32.836.13K0V

    9000650.10.11391666666666667-230627-23.107552.21-79.146.18A7V

    10000718.20.12172222222222222-172311-17.38638888888888874.36-75.906.19A6Vn
    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 @@ + + 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 @@ + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + <xsl:value-of select="$layout.page.title"/> + + + + + + + + + + + + + + + + + + + + + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + +
    + + + + + + +
      + +
    • +
      +
    +
    +
    +
    +
    + + + + + http + + s + + :// + + + : + + + + + + + + + + + + + + /album.do?key= + + + + + + + + + + + + + + + + /media.do?id= + + + &albumKey= + + + + + &original=true + + + &size= + + + &quality= + + + + + + &download=true + + + + + + + + + + + /album.do?key= + + + &itemId= + + + + + + + + + + + MB + + + + KB + + + + bytes + + + + + + + + + + + + + + + /downloadAlbum.do?albumKey= + + + + &original=true + + + + &size= + + + + &quality= + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SUB NAV + + + + + + + + + + sub nav data: collection = [ + + ]; album = [ + + ] + + + + +
    + + Tab + +
    +

    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + +
    +
    +
    + + +
    +
    This is here to "clear" the floats.
    +
    +
    +

    +
      + + + There are no collections. + +
    +

    +
      + + + There are no albums. + +
    +
    + + + +
    + main-pane content here +
    + + + + + + + +
    + +
    +

    + +

    +
    +
    +
    + + +
    +
    +
    + + +
    +
    This is here to "clear" the floats.
    +
    + + +
    +

    + +

    +
    +
    +
    + + +
    +
    +
    + + +
    +
    This is here to "clear" the floats.
    +
    + + +
    +

    + +

    +
    + + +
    +
    This is here to "clear" the floats.
    +
    + + +
    +

    + +

    +
    + + +
    +
    This is here to "clear" the floats.
    +
    + + +
    +

    + +

    +
    + +
    + + +
    +
    +
    + +
    + + +
    +
    +
    + +
    + +
    +
    +
    + + +
    +
    This is here to "clear" the floats.
    +
    + +
    + +
    + +
    + +
    + + + +
  • + + selected + + + + + +
  • + +
    + + + +
  • + + selected + + + + +
  • +
    + + + + + {@name} + + +
    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 @@ +Data Objects +Fields +bam_as_viewedit_doselect 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 @@ + 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 @@ + + + + + + + + + + + + no-sub-nav + + + + + + + + + +
    + + + + + + + + + + + + + +
    + +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + +
    + +
    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 @@ + + + + + map1key1value + map1key2value + + map2key1value + map2key2value + 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"?><cabecMsg xmlns="http://www.portalfiscal.inf.br/nfe" versao="1.09"><versaoDados>1.03</versaoDados></cabecMsg><enviNFe xmlns="http://www.portalfiscal.inf.br/nfe" versao="1.09"><idLote>200602220000001</idLote><NFe><infNFe Id="NFe28070413349550000324550010000109000000110809" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110809"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>zYASgizMNBAzgn+ot4ejStxDPTA=</DigestValue></Reference></SignedInfo><SignatureValue>WnrapbX3Ewvi10agoVw2ZXl2drRxQdEbe3AHEXwIcr3LbDKGsMhqQusQGgifJkEbLL+IKC2kE9BE/HVFLxhFN9zj7zasTo6voeRApftKmibfASYcLSMTMkRcE97qU7BKQveBb0rYtKoumF020DUofx4TQlq0XhXHwQRSMfjU+PI=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110801" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110801"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>eDf91anljJDYxbEccusEuMITI6w=</DigestValue></Reference></SignedInfo><SignatureValue>1l8xkXfjmhtrkFMXXHxyS2FQ7jM1hBIeqAxk/zVVgaAhAUvOnyqvt6EnIkbkqo+4uRyASFjhr5oFUHz5ryj9oSz+wW2Si95QIXUciWvDSAw2vbWaeusHI4fpJYqjyhUlXAelmQtgl9lkBaXhWrHkyLxTYZuUS0VHyu3SoqlY8L4=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110802" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110802"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>KgIkUWcNbSYo+9i4n1Wib3gggRI=</DigestValue></Reference></SignedInfo><SignatureValue>BrV4+H1tm4SN9sjNT2ICKOfNsVGeMAsQilsuqIw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DwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110803" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110803"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>fJTDfYgu7OhtAEucE40612pj8yo=</DigestValue></Reference></SignedInfo><SignatureValue>ROGdT3yu5ZbkhXNyn650tfD1bhNo33tYKfH1Ayp+syUJGIRfuepP58gaH8fJbuM4vU8LJozcK87tOaXc0EwM5mej6f+wZ2sv1DPglrt7Bb6Vs8j4v1HPvp7EUYoGYD8cq0IDC32h9ItHlg4H1oTxeM6U7xFMPjEndCRm7Hcym1Y=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCU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ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110804" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110804"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>Omf325HzAlgBnP9MoAA2Gbf4vbo=</DigestValue></Reference></SignedInfo><SignatureValue>vzjdVi3qU160PgIsCX9Qq07JVy98gwmtFZud6Unkn9uozWVgXGm9V2V3NJ67ke7pkcYZonXHrOTmOGTpuoaW0ZiQ55Mo50zlDS5TCBWn26stI12ecYwrqpgDENpoCKBRa5ZCa7GMaWZZyEgAYYQ8YeI9BtMqaKJnjhuXVaJErdw=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110805" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110805"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>ctmsHHDqE+E+UssdsL4jajRQVWk=</DigestValue></Reference></SignedInfo><SignatureValue>nCoM230bM4Befsnpl3w5/G0ocn1MVkGoqIMIFkcijK7QzBY7n3tK2B9tr9dFv1mN+y/WFZ6+66tKYefaioSNiI0QLVIXfrdYMtZ4+Ewe1N/1xHKlGqujglkmNRF17KH106lBxOltsuxZd5AsyxZ+nF37GIjWzpY/0jOJD4c+OO8=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110806" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110806"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>UVJeRp5XuzdojbAnEjuohV8NFO8=</DigestValue></Reference></SignedInfo><SignatureValue>5Zm+uGuO/xHT/CwgUIWobkM+JaAaYCym4/Kr4goBugykbLXyxXpHAvO4bYN050usn5kMGfELISipAVoaHXvrZ67FgaHkcKGHkymHGS+f8wLLL5TsNVRtZomdJjEy3GVQic8xpU4HUYrgOGktWpOnblaVzir0lZPeuRdkLbRe2y8=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110807" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110807"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>U+jxoc1fo7d4WXa0CrvP1YBQwgA=</DigestValue></Reference></SignedInfo><SignatureValue>QAYBZN3c09rcoVij+fkp4lahEAD5cZV3zjdqvNEE2lzTbzqonHgdT5GyO9VRCikUNm0f3gAbwjyQ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YdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110808" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110808"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>rNWb1uYrH9oj+IaQzAQgBgoNJ1Q=</DigestValue></Reference></SignedInfo><SignatureValue>NyJKj4su571ckKVCMK1Ki9QcpKBKczzxIs71nsxH4dZSCG3TUWycHoCsMjRUa7/REKoq1au1TmoZYAIYqZytyQYZ9m+Y+V8HDgGLde3Ymarz5X43MRIVsalGDSw1ukCYQptSLihiOUAT2hd8HYI1DAVWnqHnqDHvJ/wIcH9c44w=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA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ghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110810" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110810"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>g3nEVfyjf0bEYF0+TFE+f8I0Ekg=</DigestValue></Reference></SignedInfo><SignatureValue>VnwKnzSdKtp2i8rqNAFNc5NPrh1YWRTy4xvlSkcCdxHX0RAwlQ1mFL0wFUVOjNvt3KUVn9d4X5x76yjFbnXDPkcOrf/mpFl5JMhy2oruovcC0MtWrnvguSM/Ujyyl2p4MPLT1lzcUHAFPijh4MPOX694EX+KXxMW8jz9UqpXfn0=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110811" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110811"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>nhhsoA1RmioP/vXoARwWijDfkAg=</DigestValue></Reference></SignedInfo><SignatureValue>SNh8Aa27uDRSZRe7nhkEa6ZTVfJV3ljwUSlwikYTMiEMk+B6/62IQqIyfVhfSN1Lx1grYgUfrzoNRanYZWQEUcIk07ENQcIS5KgY9ydSSuuOFVuiRsk/6INm1gjR4XCq4F/tWAdenasZCtZ0DPRNH5la4GSuKevNfoLOGbKgC00=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110812" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110812"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>DFhT+RWH4lqQbbUvFNAXv/GseL0=</DigestValue></Reference></SignedInfo><SignatureValue>250R3TBs7J3uMUiLMywVtlIqn9PpB9Z9vH2vRQtcalB/Jx6bZbhYgRX6GhfVH7wrGfmtfU694g5sKm3447afm74mGV/5rvUlmECOnozuKv+SvXRK0wFvogaaXo5qCYlAqh9rOCa3W4RfVbq9TWfGevyKA7e0uKsjPctcKR/L4xg=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110813" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110813"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>Al5DzbSR6cps7LzToU+cyzc51GY=</DigestValue></Reference></SignedInfo><SignatureValue>bGf13rBYoifk5Z2e97D/TiS8oy7qjB+TAfd0ECwgtn0VlWI0z8V9QQWaShjHI6sV5EVJEZlx3s/3HeFPFRiv12d5466EuzI5ftJ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2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110814" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110814"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>0VdDjtU1ZtFc2w5EQU9FWV276ao=</DigestValue></Reference></SignedInfo><SignatureValue>oAAW20eP5P/wuxppPwQVmbrMwCaxAZhHJTGN2bL4GfWuTUhfSwUOxZjKTeSwlPUILU6MU3wMxj3QsIphfVTqRPKtxT19z31L6x8zAx5qV7Vgz+0PDnGsTutPYKxF5XWhHu7zRTTM3TdGKLujqp5jxwDBrM1qbBbYmfN6mxWhmqg=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAw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z8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110815" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110815"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>P+vIva8ejzq9bYhM1xL46vbdbEE=</DigestValue></Reference></SignedInfo><SignatureValue>tod/k9ZRlFEMakj89FM12YkHFvBJ2m4wDJwq9bPe6X3CKbv1mYIUAXTkasJL1BF5aJa/z+V0pvK2xTSOznvF1Y5H+TpdaToiZtMeFCbRF+nTqW+cudA3KsgSCjQs2U2kid4BWUNID9hCQHSCUoHsoVbsXDeD0Lbu6r/B0IB8FDU=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110816" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110816"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>llPDkiDAQfwf0brph3hhqCNXliI=</DigestValue></Reference></SignedInfo><SignatureValue>uFDUFef+q2r65uDmR8hS2DR+PAxVBtifJrOdVGmrdA0zQojPYziTlR0kZN/JIkBUkPklz9ejKoxx+XjVhZhu3OgI1ceHya0smOJEMDLfIJ0vHO7WmkunNl0/SBeR4yEGtjm7UxQ55/ZEHU0N/+cDn3iyzOB9t4wabUn5txA9JiA=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110817" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110817"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>qjS8ay1R+Kl2cRxAcxet6HZdt4M=</DigestValue></Reference></SignedInfo><SignatureValue>HoafBrpcYfLjXnH9GHUoZIuxjIhrpLyQeiM3KQMaWx6uyS7c2oXPtVs80L49S7i1CMma+RAywTiGf79RzI95mBy/Vlk4wa51m5h6qizT8NZMP3Pa2ern9+mDhDV7kNgvNl7JDi7hCPvACpGZy54TuzXs2luH5O8iUVYR+g2jD7Y=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110818" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110818"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>xgoWPViXwimNipoyKVr8h/69A7I=</DigestValue></Reference></SignedInfo><SignatureValue>bvGpF6fK/R2srzaaqG3XVDFxkvcvZ97MxAT4CBoezfiQywHPjXaEzmUXF/LMGjfbV1UEjFdoE+ZlPRU1F6Y3IreJvfQNLvXoGlnKASSHIZYWq/HCuv2q5DlUfw916Lj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YEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110819" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110819"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>YTY3upEgZtcegklKapx3PmBt1eI=</DigestValue></Reference></SignedInfo><SignatureValue>Nma+uO1zfJMPDGNgg2tRR43CQJCalIvz1uEHfWx9xUWzRQt3SZXr/Paemn/8EvmRJ1EkL2v1oZNWH5B/WvEQfWW/m2yL5CHmW1/xFXjkbfsFJ6Dd3irQSiuy+16BNiPl0yJyV3Om+zANm1zepEbAzt1yldOsMInoWTeIcOA33rg=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTB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X+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110820" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110820"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>hZA9ZbAfkJ1gGw/5zgVaFfXmuz4=</DigestValue></Reference></SignedInfo><SignatureValue>WUC6gHMQLuJa73yxDSuSzxVqds5ZBjl5OqtzOTLEEp83mKZwkako1zIhF59D2JXh5TnhwulWv7xqDzf3CxELf/rhftYIh108zFR7DDKMim2ofDcJ0ibWwBYYduVydpLQ37nGb0Cs8E8hVf5FDSamauvJhrXfC2jLfPQk1OCOmLc=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110821" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110821"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>mcwN77/JOXRmUj3Un5rnQukgOCk=</DigestValue></Reference></SignedInfo><SignatureValue>fDXHeIDC4hz/dpsT66Mi1aPryUrpuCISosHapZ7VKsvjeC+y4jFAXEXR5+9OuJr1SPzhKyhwbr8do3K6spTKYkOOZFZ4Ujk9xhGIXabtK/WLt6FuIuk98xXZVOtzwU3IyYeObkaJg1SzAKwq0qIW4rkfmn/4uJfayXNXaseJnhc=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110822" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110822"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></Dig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FBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110823" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110823"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>XmVTTTXirQvExYZ4yHj2Bz0bw/c=</DigestValue></Reference></SignedInfo><SignatureValue>1RNe6RLJyXBr3/lGcqLipxwcUvUIYznpp8cwEsIPMhVnVK+250ZGyy3ap2NvgnLDvXlmQOVUu6xUthwF8ll58dspBFIfHAqoww/KojAg+6V3Wwm+DwVc7222KbJ6eu451iqI68cUaRYQiciPTa2Y9DfDtxopr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8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110824" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110824"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>YauB6rHbqykRGk5K/ESVswxJpvs=</DigestValue></Reference></SignedInfo><SignatureValue>iBHHYQzntaGIOO62UUQ/p2svvoR8XjDoO8es7vyJ35PmrFWtocWdM9FEUW1Vp4ql7qmtzXascvw86JdPwZ0UjhPO9qKIIYk8XrzG9AY4SqF99gf1POWHK7xxmk3K3a9GivyQFwQlvNkWHmZJqdOv+s5ezUrQc+Keybnio5+cy0o=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJ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w4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110825" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110825"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>sBG0b72pNgwjtyk2sCcr2SOPgyo=</DigestValue></Reference></SignedInfo><SignatureValue>EMAWKqa79y8wFYN1TProwZcZO20OCPU6rSm41Z+QN5QdT1DcU823Lu+aNfPv70SY9ra5/6kOO1uE4My5UXsyawjPDY5EZV8di9Goyebg27DgDLWcpvwZfrBUOwGo3Q9x/VpWI5qY9OHaWpwxttIIuo2PbZl4k3+VVAkeCdeo7Q0=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110826" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110826"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>gDyFrITIpGqBPPeUls+UoQ1eFFw=</DigestValue></Reference></SignedInfo><SignatureValue>p3lSbnCBYnKbz6rpghVwsRzjIleu8R4dlvexNH+lxtYMPMSEll1C6qMHFo393SpKJu0Yufb7NRfDBhQFBYWwHJ5/GDchagr79ihn0hVRo58wDIbWwpHPqP5QlyGttdUm2BMTXaNsvwzJWycZqkkLwvjRO1M+5CD91pYYAB27u2A=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110827" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110827"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>nq3klXHixnYIhGVm/zzRuGSMwv0=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kGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110828" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110828"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>KxutkHGJ8tvxNtSAy8N4b7sgfOU=</DigestValue></Reference></SignedInfo><SignatureValue>GZ9XS/REkXN97VEYMz1AAPZ4J9Lb08TNhsloCuH8QaTaPqIIuT4dlcQgdBX7oysVc1NXUoSxFKUeej2ZMdD/J2EPxPacM8S3XlbZe5CoHKaxqR3hqPW5ANxzN61ldjDKPz+mY7dmgVttyEYQKdy44rt3lf0TqcdWfBiucZYylAM=</SignatureValue><KeyInf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YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110829" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110829"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>9eOPR0G4en+2xpr+R6nlm83gxVM=</DigestValue></Reference></SignedInfo><SignatureValue>t/Iwe+qlyWyuQpAHWdK//Lm+sRes/6EQb3I3XpFId+Xo4b8bdbcqv+Wlb7oPT5He654Yeg88z1mpHSZdtV5fdrr1dlKflrLT9AGKyYGiPcOpH2sUdQ655kJBtu/ByT6gQ8qaA+aufHmEL1CEUA5AbYAWk9CYzOi8BTs5zdsbDCA=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjA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ate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110830" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110830"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>PKubq8TelaLWOEu6e2hUS7KlvBA=</DigestValue></Reference></SignedInfo><SignatureValue>jQPSq10OxqJKbEwlQuW+RqQGV5a9iKKuc2+BZ8Qa1S9hQyg/PjtQHQYBR2LARUZIzfocfGb5+8HyGVxijtuIj2KPIH/8QGoqSHC0Ngtl9VCc7YCnOP10DOsasc6FynGZpa+0LOV+zJO119syZY4feIc67Py84fku/GJ8M1spOzg=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110831" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110831"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>fSUS3zUG0gFM15Rb5Xeuowu5q8Y=</DigestValue></Reference></SignedInfo><SignatureValue>WnN/escY4TTLdqKWdlhl9VCaotMF1lkFjxSx32va5+nFXr/gYY+bZw7tYMPq8q0glhE3i5tG08Ai3zewmIIYGLbraf/2HSogXeYbM9PfoNPwlP2tXMWbvwWqg8sm5JviGS/P7kKcbKxtB35oUk0lCo0m72Kt6vaY3bmYRsv/VNQ=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110832" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110832"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>ShPPZLiE8+w2+TYc4IbHUFAJtew=</DigestValue></Reference></SignedIn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Q5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110833" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110833"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>vH6jMKDthPy/f/oqcOu3Kl9jQIM=</DigestValue></Reference></SignedInfo><SignatureValue>Cv24RtVaYwqxTJBFFkoji77H/x76K1jKIbuulbZ0Nm9lcYk4sz14YT5ewKlmpbypuUtbl5NCSkSPsWZ4y7QCTpbddmtUX1ZPcbRLPg9I8xWG1NbcyQqlCkpS0h76163wLFjzQp4gf+a9aSVzTkw9r/URj/0m4RcmiA4UhC+mhg4=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDp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qGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110834" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110834"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>p7hP4H+8hnM91WiYpcftVEgr+Cw=</DigestValue></Reference></SignedInfo><SignatureValue>FvsM3yhnphCD3/KOg9beknJx1+kcw4RWNJQbXsWUvwQOa6uz6PFuKjHeDdUSa0tTRoRQ8t15TfP38SyOco/DmoMfBmCuj70tQxk78BZ/Z+UjESdaHgv2GSB3TBAVe2GaT6JYAKUSSCAFPY7GfgAQhOPEuk89ztQx7s4qB69IKZA=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaF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NFe><infNFe Id="NFe28070413349550000324550010000109000000110835" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110835"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>VCjVED64OxI7juJhG+0yWNlXusg=</DigestValue></Reference></SignedInfo><SignatureValue>NnmraR5m+J0bapZxL+8xsruVjidhmHqFrQwhHG4xeXeIytfQ3GgtLpaMYWO+Y+U/TrP1wKz10blLRfLa3vSuYEDuy1TI5tNjwPdmdLDXc+65YkYlO1rBYXuYHm0KIf61GPHIhvay5XUnV8VhzS7Utv2lT8p8/JyxqMHKEdg/FPY=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110836" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110836"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>9+uhMXb1wz6fc3iQbovsGOoMKC4=</DigestValue></Reference></SignedInfo><SignatureValue>tW1I5Ai8xb3GMGxkjJLpraqQLKp2dJxfdLUmm8vlpJtlFdAT4S2EYQftsiRI05ojjOrYBWb+pWemZtNhbEHSeGDMzZ6YNJwN6r7sGaRVH8IdM/2j1U87qc6jBok85nAOvAr+qoLNV4rLAca8HdqwX+evgECCvIvPuOFMovCFyi0=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110837" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110837"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>pzvez2i5zHJO5NK7aGrsXzawOKM=</DigestValue></Reference></SignedInfo><SignatureValue>qJlA6hsqLbKMr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GA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110838" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110838"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>YjkOrMdDzFQvTy/lqIxwm4HXEZU=</DigestValue></Reference></SignedInfo><SignatureValue>5OfLaCwWLSOr1PPrj8mm6TYFynD2TJlsvmontCO2+lZ83GvHCmv/o/az72L4zTJLA+7EjWLXyVDaniVLz0KT580yAAVETdy7Am+ZGWSNgEyp+Fwc5eL4AiHtMPABnhdY1Y7GIZ+m74XPJLW31ybwH8G8tJEkib9bmVUK6LLcal8=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgk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V67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110839" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110839"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>mpqSlfCCvmFn5WrxQ9Dfl5uWuPU=</DigestValue></Reference></SignedInfo><SignatureValue>yISvrdTREuQiZ1uA4dl1HrIuk1VpcYc5bWYWa7Te01UMXNZ/bmqz0LH8oFiVoqPRnHHTSJ7NvgHC79z9z+EuDbrga1uTvLlY7CvtbxD1AuChyPc7IbkM5PGIS2EMuLI74y3FpjXPLf9ZanXisSLLVc7OhbrnCTzS5YsXLSGImyk=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5Mj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413349550000324550010000109000000110840" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110840"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>9IyNbREn2DYaDA6UUVNTmUx7Pdo=</DigestValue></Reference></SignedInfo><SignatureValue>MkQ4Ors8jwGneaOz+4cbbyL8u/kBUyx26JXe0skHJmKYq08uvihpylT7DHPr3ysXwMMhjsE5uuQQnKh48JpxmIkOXFTEzKvKnliiIsjFb5ENA+QG66Ae4Wmzt1z0CeUaGLf12qzAHJfxiNklvl1vSS7Gdxt9jGN1p8sm1ziqXU4=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110841" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110841"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>KBQvgLVJ/pHIs2mchbP6r+XUV3w=</DigestValue></Reference></SignedInfo><SignatureValue>sTwck2qlVfUm+txPJzt7BshWT3zyUGYiLG4MR0RH2zm/DcjsBj/679m1/7k8lrt2E83jCSwZq8y6lVTSzJJlmXW+TVLyH3wCirheAXsWdCxQaYSeOilCPqb1kgB/qNcPReadT421qJfRGO3nMmd89HI4pCjHH1aYQPeGgytkcm4=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110842" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110842"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>3g5AU6Z5Pat0IPL/OYpTRwx4taQ=</DigestValue></Reference></SignedInfo><SignatureValue>VmXtcslq9V5bKh+ZzPRl9o+h9E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AYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110843" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110843"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>h9UKsUjSbe8JbvsUApBt2psKKAU=</DigestValue></Reference></SignedInfo><SignatureValue>TVt205QhgqS2gZc9S0IxRbgc5x+d/iXhpCQpwYpGHbsVfvjmAPl3+zRKscTC3asPH8Nf2+6IGHwtElFqF2tE9c1RrS3cDuyjiXfKaGC5KmZ/5teXuGN1l4WF4/jitaSLu0nHcfmwxVQj3XH25+gHNXBAZXJCj1mHQO0jsmgDEz0=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQ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DxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110844" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110844"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>HbZModFP0Iui9gfuR7n/4sHi024=</DigestValue></Reference></SignedInfo><SignatureValue>WPU7Sj9DeVV91fBDnlAM/JKlKaC57/ID4/jbFYkcX4uO/tf0fpVUkOEwhxDUKldf/REsxKzOy3LAs/VoOLgqh3PmMBOZkTGWQjasY150ZCZHOIPuUk6wrObozuI+V0g3Xfff6pxId+t7Z3sLMWMggSSKG8+Qs27XJmODe08l+Zg=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110845" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110845"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>t72hWlvvtDZ6wNPjniZ2pDoTj/w=</DigestValue></Reference></SignedInfo><SignatureValue>XnKgmioztIbSGyiwYq0Xc5jGA5bxvoqGaNfWSulvY/e4CM6KY95fwMS9GYbEjTxMB8wcIZpziq8jlEMRnNkF+yHn/4QI+8y8K17EF7pebG4XHUuOGAditKlHbC85Fehj40+/+S0kc2iSe2D+FzY1TGe/2B7x78u45LaUtLT9sXE=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110846" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110846"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>YsqTqpi1W7aZmk0w4pmyS9ICgIs=</DigestValue></Reference></SignedInfo><SignatureValue>NgHBGSEmJP4tPp4LViQYbDLfs7fQti90qvTJJ8KR2N0N8SPbmldwI8JRZyTldlQwUlRyaUqEE6OwFPW0vA0b4Upqqyl6p+MM7/ax+pU6PT7c/5xRzpSyPpvbLAYyMDA6dyQwfGgnxw+R1wRlZidxjyU+qX+C6xKc9/EhGC1MUOY=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110847" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110847"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>gjvLgyWmYcXiyBgjtBHrmH3do0E=</DigestValue></Reference></SignedInfo><SignatureValue>wQxpEm1stUvHMiMUQxMVzQlh/GKqusqgA3UGiVHDmFhnx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wIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110848" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110848"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>JxHrYj68TOJrQDYwbNRgpcd31wk=</DigestValue></Reference></SignedInfo><SignatureValue>WC86hQyLd3romAna+vQgzS4Y+6p6qGIzNMKyye3MJU8YWb8NzycRTqXdzmV3vTc1f7JRHZxv7OotOYGkdgO9WQtuqNmy7bUlpTw+VHDaLYk0IKODNS3AalvJ34cEYeERrWJ46VkOeTAGkA0SvO8nheChrUg9316VpQ99PJnxT2M=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1U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eFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110849" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110849"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>SXeCCjCKON99cwODW7wBGEO1vnk=</DigestValue></Reference></SignedInfo><SignatureValue>hlSBLj1DztVcfDubBVkCJ1Tgm5nvAqJF01lK2fbNzYRBozUwd7nQ+fvnHK+UI9OaR7wJKJwSY/nqK7OV1Iz1h+Nu/zFg/YV3hrG+mV+EvOzJEKhp0c7+NO45FQKhB5a+jLFCFCypOJW0OyyVGe1inhI6mC8iCCBy08LElb3x3vg=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe><NFe><infNFe Id="NFe28070413349550000324550010000109000000110850" versao="1.09"><ide><cUF>28</cUF><cNF>000011080</cNF><natOp>VENDAS PRODUCAO PROPRIA</natOp><indPag>0</indPag><mod>55</mod><serie>1</serie><nNF>10900</nNF><dEmi>2007-04-18</dEmi><dSaiEnt>2007-04-18</dSaiEnt><tpNF>1</tpNF><cMunFG>0352050</cMunFG><tpImp>2</tpImp><tpEmis>1</tpEmis><cDV>9</cDV><tpAmb>2</tpAmb><tpNFe>1</tpNFe></ide><emit><CNPJ>13349550000324</CNPJ><xNome>TOYOTA DO BRASIL LTDA</xNome><xFant>TDB IDT</xFant><enderEmit><xLgr>RODOVIA SP75</xLgr><nro>S/N</nro><xCpl>KM 48</xCpl><xBairro>CALDEIRA</xBairro><cMun>0352050</cMun><xMun>INDAIATUBA</xMun><UF>SE</UF><CEP>13330000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>1938857000</fone></enderEmit><!--IE>353080289118</IE--><IE>270621458</IE><IEST>270969918</IEST></emit><dest><CNPJ>07234453001446</CNPJ><xNome>BENARROS VEICULOS LTDA</xNome><enderDest><xLgr>AVENIDA TANCREDO NEVES</xLgr><nro>5121</nro><xBairro>JABOTIANA</xBairro><cMun>0280030</cMun><xMun>ARACAJU</xMun><UF>SE</UF><CEP>49097000</CEP><cPais>105</cPais><xPais>BRASIL</xPais><fone>7932595252</fone></enderDest><IE>270832980</IE></dest><det nItem="1"><prod><cProd>62</cProd><cEAN></cEAN><xProd>COROLLA SE-G,A/T,1.8L GAS,A/C AUT.</xProd><NCM>87032310</NCM><EXTIPI>01</EXTIPI><CFOP>6401</CFOP><uCom>TESTE</uCom><qCom>1</qCom><vUnCom>99999</vUnCom><vProd>56157.87</vProd><cEANTrib>12345678901234</cEANTrib><uTrib>PC</uTrib><qTrib>1.000</qTrib><vUnTrib>88888</vUnTrib><veicProd><tpOp>1</tpOp><chassi>9BR53ZEC278678265</chassi><cCor>205</cCor><xCor>PRETO PEROLA METALICO</xCor><pot>136</pot><CM3>1794</CM3><pesoL>1185</pesoL><pesoB>1185</pesoB><nSerie>000678265</nSerie><tpComb>GASOLINA</tpComb><nMotor>4650701</nMotor><CMKG>0</CMKG><dist>2600</dist><RENAVAM>000000000</RENAVAM><anoMod>2007</anoMod><anoFab>2007</anoFab><tpPint>M</tpPint><tpVeic>06</tpVeic><espVeic>1</espVeic><VIN>N</VIN><condVeic>1</condVeic><cMod>114810</cMod></veicProd></prod><imposto><ICMS><ICMS70><orig>0</orig><CST>70</CST><modBC>2</modBC><pRedBC>5.16</pRedBC><vBC>53453.46</vBC><pICMS>7.00</pICMS><vICMS>3741.74</vICMS><modBCST>0</modBCST><vBCST>78978.00</vBCST><pICMSST>12.00</pICMSST><vICMSST>5735.62</vICMSST></ICMS70></ICMS><IPI><cEnq>999</cEnq><IPITrib><CST>50</CST><vBC>56361.43</vBC><pIPI>13.00</pIPI><vIPI>7326.98</vIPI></IPITrib></IPI><PIS><PISAliq><CST>01</CST><vBC>56361.43</vBC><pPIS>2.00</pPIS><vPIS>1127.23</vPIS></PISAliq></PIS><COFINS><COFINSAliq><CST>01</CST><vBC>56361.43</vBC><pCOFINS>9.60</pCOFINS><vCOFINS>5410.70</vCOFINS></COFINSAliq></COFINS></imposto></det><total><ICMSTot><vBC>53453.46</vBC><vICMS>3741.74</vICMS><vBCST>78978.00</vBCST><vST>5735.62</vST><vProd>56157.87</vProd><vFrete>0.00</vFrete><vSeg>0.00</vSeg><vDesc>0.00</vDesc><vII>0</vII><vIPI>7326.98</vIPI><vPIS>1127.23</vPIS><vCOFINS>5410.70</vCOFINS><vOutro>0.00</vOutro><vNF>69220.47</vNF></ICMSTot></total><transp><modFrete>0</modFrete><transporta><CNPJ>60395589000104</CNPJ><xNome>BRAZUL TRANSP.DE VEICULOS LTDA</xNome><IE>635024834114</IE><xEnder>AV. MARIA SERVIDEI DEMARCHI, 1420,</xEnder><xMun>SAO BERNARDO DO CAMPO</xMun><UF>SP</UF></transporta><vol><qVol>1</qVol><esp>VEICULO</esp><marca>TOYOTA</marca><pesoL>1185.000</pesoL><pesoB>1185.000</pesoB></vol></transp><infAdic><infCpl>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</infCpl></infAdic></infNFe><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod><Reference URI="#NFe28070413349550000324550010000109000000110850"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></Transform></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod><DigestValue>I58ROhWJ1+GlmoKlUDAbplxrJ8w=</DigestValue></Reference></SignedInfo><SignatureValue>jb3X9Sh3OvC+EGDdH3crhS9l1TJbiIpkQ0oPbXDWLnyOCMRx3QoXC6AEqhDqP6M0eiumhDIZr4AtL96gL0KdUedTuoH1e/CV0uOvvKrz0ZQex/6grLG195lm1wiZPk4T6+OzVjez0rOmyB4BQxtC26ER0OlXrJj9uNI4bG0neCQ=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq</X509Certificate></X509Data></KeyInfo></Signature></NFe></enviNFe> + 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 @@ + + + Test for source tree numbering + + Level A + + Level B + + + Level B + + Level C + + + + Level B + + Level C + + Level D + + + + + + Level A + + Level B + + Level C + + Level D + + Level E + + + + + + + Level A + + Level B + + Level C + + Level D + + Level E + + + + Level D + + Level E + + + + + Level C + + Level D + + + + + Level B + + + 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 @@ + + + + + + + + + + + + + + + + + + : + + + + + + 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 @@ + + + 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 @@ + + 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 @@ + + + + + + + + + Euro 1: € + + + + Euro 1: € + + + 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 @@ + + + + localhost + 8484 + Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3 + en + /matte + /logon.do + + + org.springframework.web.servlet.support.RequestContext@4bf0ff + + + You must be logged in and have sufficient access privileges to view the requested page. + + + http://localhost:8484/matte/home.do + + + + */* + en + gzip, deflate + JSESSIONID=42E37E740D15356C0E861590CEA4A421; JSESSIONID=5647B2F0C0A7E5E673970E4A21D2F3FD + Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3 + keep-alive + localhost:8484 + + + no model + + 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 @@ + + + + + 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 @@ + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + 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 @@ +<_test01/><_test-04>T%e!s#t$
    1000509.90.0860833333333333345134545.22916666666667114.44-16.886.70A1Vn

    2000503.80.08438888888888889-003011-0.503055555555555698.33-61.146.29gG9

    3Psc33 Psc000520.10.08891666666666666-054227-5.707500000000000593.75-65.934.61K0IIIbCN-0.5

    4Peg86 Peg000542.00.09513234613.39611111111111106.19-47.985.51G5III

    5000616.00.1044444444444444558261258.43666666666666117.03-03.925.96G5V

    6000619.00.10527777777777779-490430-49.075321.61-66.385.70G1IV

    7Cas10 Cas000626.50.1073611111111111264114664.19611111111111118.061.755.59B9III

    8000636.80.1102222222222222229011729.02138888888889111.26-32.836.13K0V

    9000650.10.11391666666666667-230627-23.107552.21-79.146.18A7V

    10000718.20.12172222222222222-172311-17.38638888888888874.36-75.906.19A6Vn
    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 @@ + + + + + + Lego-Model01 + 65.99 + + + Lego-Model2 + 69.99 + + + Lego-Model3 + 14.99 + + + Barbie-Pink + 12.99 + + + Barbie-Blue + 13.99 + + + Barbie-White + 13.99 + + + Barbie-Plain + 13.99 + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + +
    +

    + +

    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    +
    +
    + + + + + +
    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 @@ + + + + + + + + + + + + + + + + + + + no-sub-nav + + + + + + + + + + + + + + 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 @@ + + + + + + + + + " + \" + + + + + + + + + ' + \' + + + + + + + + + + + + \ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 350 + + + + + + + + + + + + + + + + + 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 @@ + + 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 @@ + + + + + + + + + + + + + + + + + + + + + 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 = "\n" + "\n" + " \n" + + " \n" + " \n" + " \n" + " \n" + + " \n" + " \n" + "\n"; + + public static final String XML = "\n" + "\n" + " \n" + " 123abc\n" + " \n" + + "\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 = "\n" + "\n" + " \n" + "\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 = "\n" + "\n" + " \n" + + "\n"; + + public static final String XML = "\n" + "1234abc\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 = "\n" + "\n" + " \n" + + " \n" + " \n" + " \n" + " \n" + + " \n" + " \n" + " \n" + "\n"; + + public static final String XML = "\n" + "\n" + " 123abc\n" + + "\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 = "\n" + "\n" + " \n" + + " \n" + " \n" + " \n" + " \n" + + " \n" + " \n" + " \n" + + " \n" + "\n"; + + public static final String XML = "\n" + "\n" + " 123abc\n" + + "\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 = "\n" + "\n" + " \n" + "\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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 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(""); + 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 @@ + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + 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 = "\n" + "\n" + " \n" + + " \n" + " \n" + "\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 = "\n" + "\n" + " \n" + " \n" + " \n" + + " \n" + " \n" + " \n" + + " \n" + " \n" + "\n"; + + public static final String XML = "\n" + "\n" + "\n" + + " 123abc\n" + "\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 @@ + + 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 @@ + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + 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 = "" + "" + "CheetahTech" + + "CheetahView" + "" + ""; + /** Schema */ + public static final String 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 @@ + + + + + +
    + + Narayanan Jayaratchagan +
    +
    + +
    + + Daniel Steinberg +
    +
    +
    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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 = "\n" + "\n" + + " \n" + " \n" + " \n" + + " \n" + "\n"; + + public static final String XML = "\n" + "abc\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 @@ + + 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 @@ + + + + + + + + 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 = "\n" + " \n" + + ""; + + @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 @@ + + + + commentZZZZZZZZZZZZZZZZZZ + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 @@ + + + + b972115d-829e-43ff-aebb-c7157ef25c71 + 01AP + A9901017 + A0500823 + 221 + + + 89 + 01AP + 2008 + A + 68 + KJ091 + 5000 + + + 97 + + + + + LL091 + 68700 + + + 98 + + + + + HH098 + 8000 + + + 96 + + + + + PO091 + 7500 + + + 92 + + + + + 098 + 14000 + + + + + 21 + EF01 + 26800 + + + 22 + G + 15000 + + + 20 + HH + 9810 + + + 20 + DEE + 51590 + + + 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 = "\n" + "\n" + " \n" + + "\n"; + + String xml = "\n" + "\n" + " abc\n" + "\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 @@ + +text + + 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 = "\n" + "\n" + "\n" + + "\n" + "\n" + "\n" + "\n" + "\n" + + ""; + + 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 @@ + + + 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + +falseresource80.stoppedJ2EEtruetruefalse + 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 @@ + + 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 @@ + + + + + + + + EDI_DC40 + + + + + 1 + + + + CREMAS01 + + CREMAS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + Segment for general vendor data + + + + + + + Function + + + + + + + + + + + + Account number of the vendor or creditor + + + + + + + + + + + + Title + + + + + + + + + + + + Train station + + + + + + + + + + + + International location number (part 1) + + + + + + + + + + + + International location number (part 2) + + + + + + + + + + + + Authorization group + + + + + + + + + + + + Industry key + + + + + + + + + + + + Check digit for the international location number + + + + + + + + + + + + Number of data communication line + + + + + + + + + + + + Indicator 'report to Central Bank' for data medium exchange + + + + + + + + + + + + Instruction key for data medium exchange + + + + + + + + + + + + Date on which the record was created + + + + + + + + + + + + Name of person who created object + + + + + + + + + + + + POR subscriber number + + + + + + + + + + + + Group key + + + + + + + + + + + + Vendor account group + + + + + + + + + + + + Customer number + + + + + + + + + + + + Country of company + + + + + + + + + + + + Account number of the vendor or creditor + + + + + + + + + + + + Central deletion flag for master record + + + + + + + + + + + + Last name of employee + + + + + + + + + + + + Last name of employee + + + + + + + + + + + + Last name of employee + + + + + + + + + + + + Last name of employee + + + + + + + + + + + + City + + + + + + + + + + + + District + + + + + + + + + + + + Post office box + + + + + + + + + + + + Postal code + + + + + + + + + + + + Postal code + + + + + + + + + + + + Region (State, Province, County) + + + + + + + + + + + + Character field length = 10 + + + + + + + + + + + + Central posting block + + + + + + + + + + + + Centrally imposed purchasing block + + + + + + + + + + + + Language keys + + + + + + + + + + + + Tax number 1 + + + + + + + + + + + + Tax number 2 + + + + + + + + + + + + Indicator: Business partner subject to equalization tax ? + + + + + + + + + + + + Indicator: Business partner subject to tax on sales/purch. ? + + + + + + + + + + + + Street and house number + + + + + + + + + + + + Telebox number + + + + + + + + + + + + First telephone number + + + + + + + + + + + + Second telephone number + + + + + + + + + + + + Fax number + + + + + + + + + + + + Teletex number + + + + + + + + + + + + Telex number + + + + + + + + + + + + Indicator: Is the account a one-time account? + + + + + + + + + + + + Indicator: Alternative payee in document allowed ? + + + + + + + + + + + + Company ID of trading partner + + + + + + + + + + + + Account number of the master record with fiscal address + + + + + + + + + + + + VAT registration number + + + + + + + + + + + + Indicator: Business partner a sole proprietor ? + + + + + + + + + + + + Functions that will be blocked + + + + + + + + + + + + Address + + + + + + + + + + + + Search string for matchcode usage + + + + + + + + + + + + Search string for using matchcodes + + + + + + + + + + + + Search string for matchcode usage + + + + + + + + + + + + Place of birth of the person subject to withholding tax + + + + + + + + + + + + Date of birth + + + + + + + + + + + + Key for the sex of the person subject to withholding tax + + + + + + + + + + + + Credit information number + + + + + + + + + + + + Last review (external) + + + + + + + + + + + + Vendor's QM system + + + + + + + + + + + + Reference account group for one-time account (vendor) + + + + + + + + + + + + PO box city + + + + + + + + + + + + Plant + + + + + + + + + + + + Indicator: vendor sub-range relevant + + + + + + + + + + + + Indicator: plant level relevant + + + + + + + + + + + + Factory calendar key + + + + + + + + + + + + Status of data transfer into subsequent release + + + + + + + + + + + + Jurisdiction for tax calculation - tax jurisdiction code + + + + + + + + + + + + + + + + + + + + Segment for bank details of vendor SMD + + + + + + + Function + + + + + + + + + + + + Account number of the vendor or creditor + + + + + + + + + + + + Bank country key + + + + + + + + + + + + Bank key + + + + + + + + + + + + Bank account number + + + + + + + + + + + + Bank control key + + + + + + + + + + + + Partner bank type + + + + + + + + + + + + Indicator: Is there collection authorization ? + + + + + + + + + + + + Name of the bank + + + + + + + + + + + + Region (no longer used as of release 3.0D!!!) + + + + + + + + + + + + Street (no longer used as of release 3.0D!!!) + + + + + + + + + + + + Location + + + + + + + + + + + + SWIFT code for international payments + + + + + + + + + + + + Bank group (bank network) + + + + + + + + + + + + Checkbox + + + + + + + + + + + + Bank number + + + + + + + + + + + + Post office bank current account number + + + + + + + + + + + + Reference specifications for bank details + + + + + + + + + + + + Bank branch + + + + + + + + + + + + Region (State, Province, County) + + + + + + + + + + + + Street and house number + + + + + + + + + + + + City + + + + + + + + + + + + + + + Reminder data for vendor SMD + + + + + + + Function + + + + + + + + + + + + Account number of the vendor or creditor + + + + + + + + + + + + Company code + + + + + + + + + + + + Dunning area + + + + + + + + + + + + Dunning procedure + + + + + + + + + + + + Dunning block + + + + + + + + + + + + Last dunned on + + + + + + + + + + + + Character field of length 1 + + + + + + + + + + + + Account number of the dunning recipient + + + + + + + + + + + + Date of the legal dunning proceedings + + + + + + + + + + + + Accounting clerk + + + + + + + + + + + + + + + + + TABNAM + + + + + + + MANDT + + + + + + + + + + + + DOCNUM + + + + + + + + + + + + DOCREL + + + + + + + + + + + + STATUS + + + + + + + + + + + + DIRECT + + + + + + + + Outbound + + + + + + + Inbound + + + + + + + + + + OUTMOD + + + + + + + + + + + + EXPRSS + + + + + + + + + + + + TEST + + + + + + + + + + + + IDOCTYP + + + + + + + CIMTYP + + + + + + + + + + + + MESTYP + + + + + + + MESCOD + + + + + + + + + + + + MESFCT + + + + + + + + + + + + STD + + + + + + + + + + + + STDVRS + + + + + + + + + + + + STDMES + + + + + + + + + + + + SNDPOR + + + + + + + + + + + + SNDPRT + + + + + + + + + + + + SNDPFC + + + + + + + + + + + + SNDPRN + + + + + + + + + + + + SNDSAD + + + + + + + + + + + + SNDLAD + + + + + + + + + + + + RCVPOR + + + + + + + + + + + + RCVPRT + + + + + + + + + + + + RCVPFC + + + + + + + + + + + + RCVPRN + + + + + + + + + + + + RCVSAD + + + + + + + + + + + + RCVLAD + + + + + + + + + + + + CREDAT + + + + + + + + + + + + CRETIM + + + + + + + + + + + + REFINT + + + + + + + + + + + + REFGRP + + + + + + + + + + + + REFMES + + + + + + + + + + + + ARCKEY + + + + + + + + + + + + SERIAL + + + + + + + + + + + + + + + Segment for EU tax numbers vendors + + + + + + + Function + + + + + + + + + + + + Account number of the vendor or creditor + + + + + + + + + + + + Country key + + + + + + + + + + + + VAT registration number + + + + + + + + + + + + + + + Segment for vendor sub-range identification SMD + + + + + + + Function + + + + + + + + + + + + Language keys + + + + + + + + + + + + Account number of the vendor or creditor + + + + + + + + + + + + Vendor sub-range + + + + + + + + + + + + Description + + + + + + + + + + + + + + + Segment purchasing data for vendor MMS SMD + + + + + + + Function + + + + + + + + + + + + Account number of the vendor or creditor + + + + + + + + + + + + Purchasing organization + + + + + + + + + + + + Vendor sub-range + + + + + + + + + + + + Plant + + + + + + + + + + + + Date on which the record was created + + + + + + + + + + + + Name of person who created object + + + + + + + + + + + + Purchasing block at purchasing organization level + + + + + + + + + + + + Deletion indicator + + + + + + + + + + + + ABC indicator + + + + + + + + + + + + Purchase order currency + + + + + + + + + + + + Responsible salesperson at vendor's office + + + + + + + + + + + + Vendor's telephone number + + + + + + + + + + + + Minimum order value + + + + + + + + + + + + Terms of payment key + + + + + + + + + + + + Incoterms (part 1) + + + + + + + + + + + + Incoterms (part 2) + + + + + + + + + + + + Indicator: GR-based invoice verification + + + + + + + + + + + + Indicator: acknowledgment required + + + + + + + + + + + + Group for calculation schema (vendor) + + + + + + + + + + + + Automatic generation of purchase order allowed + + + + + + + + + + + + Mode of transport (when goods cross border) + + + + + + + + + + + + Customs office + + + + + + + + + + + + Pricing date control + + + + + + + + + + + + Purchasing group + + + + + + + + + + + + Indicator: vendor subject to subseq. settlement accounting + + + + + + + + + + + + Comparison/agreement of business volumes necessary + + + + + + + + + + + + Evaluated receipt settlement (ERS) + + + + + + + + + + + + Planned delivery time in days + + + + + + + + + + + + Planning calendar + + + + + + + + + + + + Planning cycle + + + + + + + + + + + + Delivery cycle + + + + + + + + + + + + Purchase order entry: vendor + + + + + + + + + + + + Price marking, vendor + + + + + + + + + + + + Rack-jobbing: vendor + + + + + + + + + + + + MRP controller + + + + + + + + + + + + + + + Segment for company code data for vendors SMD + + + + + + + Function + + + + + + + + + + + + Account number of the vendor or creditor + + + + + + + + + + + + Company code + + + + + + + + + + + + Date on which the record was created + + + + + + + + + + + + Name of person who created object + + + + + + + + + + + + Posting block for company code + + + + + + + + + + + + Deletion flag for master record (company code level) + + + + + + + + + + + + Key for sorting according to allocation numbers + + + + + + + + + + + + Reconciliation account in general ledger + + + + + + + + + + + + Authorization group + + + + + + + + + + + + Interest calculation indicator + + + + + + + + + + + + List of the payment methods to be considered + + + + + + + + + + + + Indicator: Clearing between customer and vendor? + + + + + + + + + + + + Block key for payment + + + + + + + + + + + + Terms of payment key + + + + + + + + + + + + Our account number at the customer or vendor + + + + + + + + + + + + User at vendor + + + + + + + + + + + + Memo + + + + + + + + + + + + Planning group + + + + + + + + + + + + Accounting clerk + + + + + + + + + + + + Head office account number + + + + + + + + + + + + Account number of the alternative payee + + + + + + + + + + + + Key date of the last interest calculation + + + + + + + + + + + + Interest calculation frequency in months + + + + + + + + + + + + Date of the last interest calculation run + + + + + + + + + + + + Indicator: local processing? + + + + + + + + + + + + Bill of exchange limit (in local currency) + + + + + + + + + + + + Probable time until check is paid + + + + + + + + + + + + Check flag for double invoices or credit memos + + + + + + + + + + + + Tolerance group for the business partner + + + + + + + + + + + + Short key for a house bank + + + + + + + + + + + + Indicator: Pay all items separately ? + + + + + + + + + + + + Certificate number of the withholding tax exemption + + + + + + + + + + + + Validity date for withholding tax exemption certificate + + + + + + + + + + + + Withholding tax code + + + + + + + + + + + + Subsidy indicator for determining the reduction rates + + + + + + + + + + + + Minority indicators + + + + + + + + + + + + Previous master record number + + + + + + + + + + + + Key for payment grouping + + + + + + + + + + + + Key for dunning notice grouping + + + + + + + + + + + + Payment method supplement + + + + + + + + + + + + Vendor recipient type + + + + + + + + + + + + Authority for exemption from withholding tax + + + + + + + + + + + + Withholding tax country key + + + + + + + + + + + + Indicator: send payment advices by EDI + + + + + + + + + + + + Release approval group + + + + + + + + + + + + Accounting clerk's fax number at the customer/vendor + + + + + + + + + + + + + + + + Segment for purchasing organization data vendor SMD + + + + + + + Function + + + + + + + + + + + + Vendor's account number + + + + + + + + + + + + Purchasing organization + + + + + + + + + + + + Date on which the record was created + + + + + + + + + + + + Name of person who created object + + + + + + + + + + + + Purchasing block at purchasing organization level + + + + + + + + + + + + Delete flag for vendor at purchasing level + + + + + + + + + + + + ABC indicator + + + + + + + + + + + + Purchase order currency + + + + + + + + + + + + Responsible salesperson at vendor's office + + + + + + + + + + + + Vendor's telephone number + + + + + + + + + + + + Minimum order value + + + + + + + + + + + + Terms of payment key + + + + + + + + + + + + Incoterms (part 1) + + + + + + + + + + + + Incoterms (part 2) + + + + + + + + + + + + Indicator: GR-based invoice verification + + + + + + + + + + + + Indicator: acknowledgment required + + + + + + + + + + + + Group for calculation schema (vendor) + + + + + + + + + + + + Automatic generation of purchase order allowed + + + + + + + + + + + + Mode of transport (when goods cross border) + + + + + + + + + + + + Customs office + + + + + + + + + + + + Pricing date control + + + + + + + + + + + + Purchasing group + + + + + + + + + + + + Indicator: vendor subject to subseq. settlement accounting + + + + + + + + + + + + Comparison/agreement of business volumes necessary + + + + + + + + + + + + Evaluated receipt settlement (ERS) + + + + + + + + + + + + Planned delivery time in days + + + + + + + + + + + + Planning calendar + + + + + + + + + + + + Planning cycle + + + + + + + + + + + + Delivery cycle + + + + + + + + + + + + Purchase order entry: vendor + + + + + + + + + + + + Price marking, vendor + + + + + + + + + + + + Rack-jobbing: vendor + + + + + + + + + + + + Indicator: index compilation for subseq. settlement active + + + + + + + + + + + + + + + + + Segment for vendor sub-range MMS SMD + + + + + + + Function + + + + + + + + + + + + Account number of the vendor or creditor + + + + + + + + + + + + Vendor sub-range + + + + + + + + + + + + Name of person who created object + + + + + + + + + + + + Date on which the record was created + + + + + + + + + + + + Language keys + + + + + + + + + + + + Description + + + + + + + + + + + + + + + + Vendor master data distribution ALE + + + + + + + + + + + + Segment for addresses of vendors MMS SMD + + + + + + + Function + + + + + + + + + + + + Account number of the vendor or creditor + + + + + + + + + + + + Purchasing organization + + + + + + + + + + + + Vendor sub-range + + + + + + + + + + + + Plant + + + + + + + + + + + + Partner function ID (e.g. SH for ship-to party) + + + + + + + + + + + + Partner counter + + + + + + + + + + + + Name of person who created object + + + + + + + + + + + + Date on which the record was created + + + + + + + + + + + + Reference to other vendor + + + + + + + + + + + + Default partner + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 , 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 @@ + + + + Hege Refsnes + Cecilie + + + Tove Refsnes + Hege + Stale + Jim + Borge + + + Stale Refsnes + + + 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 @@ + + + + Hege Refsnes + Cecilie + + + Tove Refsnes + Hege + Stale + Jim + + + Stale Refsnes + + + 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 @@ + + + + Hege + Stale + Jim + Borge + + + 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 @@ + + + + Hege + Stale + Jim + + + 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 @@ + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + 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 list = new ArrayList(); + 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 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 @@ + + + + ToyotaCamry1998white + + + + ToyotaCorolla1999red + + 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 @@ + + + + + --01-- + --01--Z + --01---08:00 + foo + 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 @@ + + + + + --01 + --01Z + --01-08:00 + 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 @@ + + + + + + + + + + + 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 @@ + + + + + + + + + + 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 @@ + + + + + + + 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 @@ + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + 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 @@ + + + + + + + + + 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 @@ + + + + + + + + + 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 @@ + + + + Hege Refsnes + + Jim + Hege + Stale + Sheldon + Penny + John + + + Hege Refsnes + + Jim + Hege + Stale + + + Hege Refsnes + + Jim + Hege + Stale + + Jim + Hege + Stale + Sheldon + Penny + John + + 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 @@ + + + + Hege Refsnes + + Jim + Hege + Stale + + + + Hege Refsnes Jr. + + Jim + Hege + Stale + + Jim + Hege + Stale + Sheldon + Penny + John + + 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 @@ + + + + Hege Refsnes + + + + Hege Refsnes + John + Doe + + + 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 @@ + + + + Hege Refsnes + Cecilie + + + Hege Refsnes + Peter + Cecilie + Hege + + + Tove Refsnes + Peter + Pan + Hege + Stale + Jim + + + Tove Refsnes + Hege + Stale + Jim + Sheldon + + + Stale Refsnes + Peter + Pan + Jim + Hege + Stale + Sheldon + Penny + + 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 @@ + + + + Hege Refsnes + + + + + Hege Refsnes + + John + + + + Hege Refsnes + + John + Doe + + 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 @@ + + + + Hege Refsnes + Peter + Pan + Cecilie + Hege + Jim + + + Stale Refsnes + Peter + Pan + Jim + Morris + Jim + Hege + Stale + Sheldon + Penny + Billy + + 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 @@ + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + Hege Refsnes + + Jim + Hege + Stale + Sheldon + Penny + John + + 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 @@ + + + + Hege Refsnes + + + + Hege Refsnes Jr. + + Jim + Hege + Stale + Sheldon + Penny + John + + 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 @@ + + + + Hege Refsnes + + + 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 @@ + + + + Hege Refsnes + Cecilie + + + Hege Refsnes + Cecilie + Hege + + + Tove Refsnes + Hege + Stale + Jim + + + Tove Refsnes + Hege + Stale + Jim + Sheldon + + + Stale Refsnes + Jim + Hege + Stale + Sheldon + Penny + + 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 @@ + + + + Hege Refsnes + + Hege + Stale + + 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 @@ + + + + Tove Refsnes + Hege + Stale + Jim + + + Tove Refsnes + Hege + Stale + Jim + Sheldon + + + Stale Refsnes + Jim + Hege + Stale + Sheldon + Penny + + + Stale Refsnes + Jim + Hege + Stale + Sheldon + Penny + Jim + Hege + Stale + Sheldon + Penny + + 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 @@ + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + Stub document 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 @@ + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + 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 @@ + + + 1 + true + false + x + y + 1 + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +٠ +١ +٢ +٣ +٤ +٥ +٦ +٧ +٨ +٩ +۰ +۱ +۲ +۳ +۴ +۵ +۶ +۷ +۸ +۹ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 𝟎 + 𝟿 + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + ʰ + ʰ + + 𪘀 + + + + + + + + + + 𝟿 + + + + + + + + + + + + + + + + + 𝞨 + 𝟉 + Dž + Dž + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + test + + + + information + + 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 @@ + + + + + + + + + + + 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 @@ + + + + + + + + + + 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 @@ + + + + + + + + + + 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 @@ + + + + + + + + + + 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 @@ + + + + + + + + + + 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 @@ + + + + + + + + + + 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 @@ + + + + + + a + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + #xD; + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + #xA; + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + 1 + x + y + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + 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 @@ + + + + + + Lego-Model01 + 65.99 + + + Lego-Model2 + 69.99 + + + Lego-Model3 + 14.99 + + + Barbie-Pink + 12.99 + + + Barbie-Blue + 13.99 + + + Barbie-White + 13.99 + + + Barbie-Plain + 13.99 + + 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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(""))); + 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("")), 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("")), 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 @@ + + 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 = "" + "" + " " + "]>" + ""; + + 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 @@ + + +]> +xxx 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 @@ + +the test 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 @@ + + + + + + + + + + + + + + + + + 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 @@ + + 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 @@ + + + + + + + + + + + + + + + + + + + + + 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 = ""; + + @BeforeMethod + protected void setUp() { + Document doc = null; + DocumentBuilder parser = null; + String xml1 = ""; + 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 = ""; + + 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 @@ + + + + + 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 @@ + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +
    + + + + + + +
    +
     
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + if (this.disabled==0) this.className='' + + + if (this.disabled==0) this.className='Hov' + + + if (this.disabled==0) this.className='Hov' + + + if (this.disabled==0) this.className='' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +  + + + +  + + + + + + + + + + + + + + + + + + + + +  + + + +  + + +
    + + + +  + + + +  + + + + + + +  + + + +  + + +
    +
    + + + + + + + + + + + + + +
    + + + _Save + + + _Save + + + javascript: + + top.. + + save() + + +   + + + _Cancel + + + _Cancel + + + javascript: + + top.. + + cancel() + + +   + + + _Help + + + _Help + + + javascript: + +top.. + + help() + + +
    +
    + + + + + + + + + + _Delete + + + _Delete + + + javascript: + +top.. + +deleteSelectedGroup() + + +   + + + _Edit + + + _Edit + + + javascript: + + top.. + + editSelectedGroup() + + + + + + + _Close + + + _Close + + + javascript: + + top.. + + cancel() + +   + + + _Help + + + _Help + + + javascript: + + top.. + + help() + + + + + + + + + + + + + + + + + + +
    + + + _Save + + + _Save + + + javascript: + + top.. + + save() + + +   + + + _Save and Add Another + + + _Save and Add Another + + + javascript: + + top.. + + save(true) + + +   + + + _Cancel + + + _Cancel + + + javascript: + + top.. + + cancel() + + +   + + + _Help + + + _Help + + + javascript: + +top.. + + help() + + +
    +
    + + + + + + + + + + + + + + + + +
    + + + + + javascript: + + top. + . + + ok() + + +   + + + _Cancel + + + _Cancel + + + javascript: + + top.. + + cancel() + + +   + + + _Help + + + _Help + + + javascript:openhelp(' + + + + /help//p5.html#aefay'); + + + + /help//p5.html#aefaz'); + + + + /help//p6.html#aefba'); + + + + /help//p9.html#gbmoc'); + + + + /help//p36.html#gbfgy'); + + + + /help//p6.html#aefbb'); + + + + +
    +
    + + + + + + + + + + + + + + + + + + +
    + + + _Close + + + javascript:goBack() + + + + +  + + + + _Help + + +javascript:openhelp(' + + ') + + + +
    +
    + + + + + + + + + + + + +
    + +
      + + + + + + +
    + * +   + + _Indicates required information + +
    +
     
    +
    + +
    + 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 = "" + " " + " " + " " + " " + "\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 = "" + "" + "" + + "" + "]>" + "" + ""; + + 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 = "" + "" + "" + + "" + "]>" + "" + ""; + + 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 = "\n" + " 1 \n"; + + static final String test1_xml = "\n" + "\n" + " \n" + "]>\n" + + "\n"; + + static final String test2_xml = "\n" + "\n" + + " \n" + " \n" + "]>\n" + "\n"; + + static final String test3_xml = "\n" + "\n" + " \n" + + "]>\n" + "\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,
    + * pre-conditions: the doc contains two subsequent processing + * instrictions,
    + * name: canonical-form
    + * value: true.
    + * Expected results: 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,
    + * pre-conditions: 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,
    + * name: canonical-form
    + * value: true.
    + * Expected results: 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,
    + * pre-conditions: the doc's root element contains superfluous + * namespace declarations,
    + * name: canonical-form
    + * value: true.
    + * Expected results: 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,
    + * pre-conditions: setting the "canonical-form" to true is supported,
    + * name: canonical-form
    + * value: true.
    + * Expected results: 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,
    + * pre-conditions: the root element has one CDATASection followed by + * one Text node,
    + * name: cdata-sections
    + * value: true.
    + * Expected results: 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,
    + * pre-conditions: the root element has one CDATASection followed by + * one Text node,
    + * name: cdata-sections
    + * value: false.
    + * Expected results: 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,
    + * pre-conditions: the root element has one Text node with not fully + * normalized characters, the 'check-character-normalization' parameter set + * to true,
    + * name: error-handler
    + * value: DOMErrorHandler.
    + * Expected results: 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("\u0073\u0075\u0063\u0327\u006F\u006E"); + 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,
    + * pre-conditions: the root element contains a fully-normalized text,
    + * name: check-character-normalization
    + * value: false.
    + * Expected results: 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("fully-normalized"); + 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,
    + * pre-conditions: the root element has two Comment nodes,
    + * name: comments
    + * value: true.
    + * Expected results: 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,
    + * pre-conditions: the root element has two Comment nodes,
    + * name: comments
    + * value: false.
    + * Expected results: 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,
    + * pre-conditions: 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),
    + * name: datatype-normalization
    + * value: true.
    + * Expected results: 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,
    + * pre-conditions: 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),
    + * name: datatype-normalization
    + * value: false.
    + * Expected results: 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,
    + * pre-conditions: the doc contains one entity and one entity + * reference,
    + * name: entities
    + * value: true.
    + * Expected results: 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,
    + * pre-conditions: the doc contains one entity and one entity + * reference,
    + * name: entities
    + * value: false.
    + * Expected results: 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,
    + * pre-conditions: the 'infoset' parameter is set to true,
    + * name: infoset
    + * value: false.
    + * Expected results: 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,
    + * pre-conditions: A document with one root element created. The + * prefix 'ns' is bound to 'namespaceURI'. The 'namespaces' parameter is set + * to true,
    + * name: namespace-declarations
    + * value: false.
    + * Expected results: 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,
    + * pre-conditions: an attribute value is not fully normalized,
    + * name: normalize-characters
    + * value: false.
    + * Expected results: 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,
    + * pre-conditions: The root element has invalid content. The + * 'validate' parameter is set to true. The 'schema-location' parameter is + * set to 'DOMConfigurationTest.xsd'.,
    + * name: schema-type
    + * value: http://www.w3.org/2001/XMLSchema.
    + * Expected results: 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,
    + * pre-conditions: The root contains a CDATASection with the + * termination marker ']]>',
    + * name: split-cdata-sections
    + * value: true.
    + * Expected results: 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,
    + * pre-conditions: The root contains a CDATASection with the + * termination marker ']]>',
    + * name: split-cdata-sections
    + * value: false.
    + * Expected results: 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,
    + * pre-conditions: The root element has invalid content. The schema + * is specified by setting the 'schema-location' and the 'schema-type' + * parameters.,
    + * name: validate-if-schema
    + * value: false.
    + * Expected results: 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,
    + * pre-conditions: The root element is not declared in the schema + * specified by setting the 'schema-location' and the 'schema-type' + * parameters.,
    + * name: validate-if-schema
    + * value: true.
    + * Expected results: 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,
    + * pre-conditions: the attribute has EntityReference to '<',
    + * name: well-formed
    + * value: true.
    + * Expected results: 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,
    + * pre-conditions: the attribute has EntityReference to '<',
    + * name: well-formed
    + * value: false.
    + * Expected results: 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,
    + * pre-conditions: the document root element has a text node with + * four white space characters,
    + * name: element-content-whitespace
    + * value: true.
    + * Expected results: 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,
    + * pre-conditions: the document root element has a text node with + * four white space characters,
    + * name: element-content-whitespace
    + * value: false.
    + * Expected results: 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 @@ + + + + + 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 = "" + "" + "]>" + ""; + + 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 = ""; + + @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 = "test1"; + 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("-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("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("-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 = "test1"; + private static DOMImplementationLS implLS; + + @Test + public void testStringSourceWithXmlDecl() { + String result = prepare(XML_STRING, true); + System.out.println("testStringSource: output: " + result); + Assert.assertTrue(result.indexOf("test1"; + + /** + * Equivalence class partitioning + * with state, input and output values orientation + * for public Document parse(LSInput is), + *
    pre-conditions: set filter that REJECTs any CHILD* node, + *
    is: xml1 + *
    output: 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 = "test1"; + 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),
    + * pre-conditions: set filter that SKIPs ELEMENT1 node,
    + * is: xml1
    + * output: 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 = "test1"; + 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),
    + * pre-conditions: set filter that SKIPs ELEMENT1 node,
    + * is: xml1
    + * output: 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 = ""; + 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),
    + * pre-conditions: set filter that accepts all,
    + * is: xml1
    + * output: 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 = "test1"; + 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),
    + * pre-conditions: set filter that REJECTs all,
    + * is: xml1
    + * output: 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),
    + * pre-conditions: set filter that SKIPs all,
    + * is: xml1
    + * output: 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),
    + * pre-conditions: set filter that REJECTs any CHILD* start element,
    + * is: xml1
    + * output: 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 = "test1"; + 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),
    + * pre-conditions: set filter that SKIPs ELEMENT1 start element,
    + * is: xml1
    + * output: 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 = "test1"; + 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),
    + * pre-conditions: set filter that SKIPs ELEMENT1 start element,
    + * is: xml1
    + * output: 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 = ""; + 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),
    + * pre-conditions: set filter that REJECTs all start element,
    + * is: xml1
    + * output: 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),
    + * pre-conditions: set filter that SKIPs all,
    + * is: xml1
    + * output: 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 = "" + "" + "world" + ""; + + 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 = "\n" + "" + "world" + "" + + ""; + /**JDK-8035467 + * no newline in default output + */ + final String XML_DOCUMENT_DEFAULT_PRINT = + "" + + "" + + "world" + + "" + + ""; + + final String XML_DOCUMENT_PRETTY_PRINT = "" + "" + "world" + "" + "\n" + " " + + "" + "\n" + " " + "" + "\n" + " " + "" + "\n" + "" + "\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 = "\n" + "" + "world" + "" + + ""; + + /**JDK-8035467 + * no newline in default output + */ + final String XML11_DOCUMENT_OUTPUT = + "" + + "" + + "world" + + "" + + ""; + + // 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 @@ + + + + + + + +]> + +Tove +Jani +Reminder +Don't forget me this weekend! + 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 @@ + +the test 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 @@ + + + + + + + + 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 = "\n\u0000"; + + 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 = ""; + + @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 = "abc"; + 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 = "Issue 56: SAXException does not do the exception chaining properly"; + 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 = "Issue 56: SAXException does not do the exception chaining properly"; + 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 @@ + + + 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 @@ + + +%external; + + + + +]> + + + + + + + Hello]]> + + &name1; + 98470 + + + &name2; + 345 + + + 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 @@ + + +%external; + + + + +]> + + + + + + + Hello]]> + + &name1; + 98470 + + + &name3; + 345 + + + 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 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. + *

    + * However: as per javadocs of {@link XMLStreamReader#getPrefix}, from JDK + * 1.6 indicate, the current understanding is that null 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 a2b0a2413e98a3f31ac10cc6486f0bf706965732 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Wed, 19 Nov 2014 13:46:04 +0100 Subject: [PATCH 075/138] 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 Date: Wed, 19 Nov 2014 17:43:19 +0300 Subject: [PATCH 076/138] 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 ac5d9dad16074d711719b134b61ecc0d13baac76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gr=C3=B6nlund?= Date: Wed, 19 Nov 2014 16:08:01 +0100 Subject: [PATCH 077/138] 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" -#else +#else // !INCLUDE_TRACE class TraceEvent { public: @@ -66,9 +63,8 @@ public: -#endif - -#endif +#endif // INCLUDE_TRACE +#endif // TRACEFILES_TRACEEVENTCLASSES_HPP 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 @@ -#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 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 @@ -#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 TYPE_; -#endif // JFRFILES_JFRTYPES_HPP +#endif // TRACEFILES_TRACETYPES_HPP 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 Date: Wed, 19 Nov 2014 19:22:49 +0400 Subject: [PATCH 078/138] 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 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 Date: Wed, 19 Nov 2014 13:02:11 -0500 Subject: [PATCH 079/138] 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 { 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 @ 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 Date: Wed, 19 Nov 2014 19:31:13 -0800 Subject: [PATCH 080/138] 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 aba13c04f26058473c6077fa51a63212f2de1e14 Mon Sep 17 00:00:00 2001 From: Alexander Harlap Date: Thu, 20 Nov 2014 10:03:22 -0500 Subject: [PATCH 081/138] 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 Date: Thu, 20 Nov 2014 09:43:13 -0800 Subject: [PATCH 082/138] 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 Date: Thu, 20 Nov 2014 11:00:29 -0800 Subject: [PATCH 083/138] 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 Date: Thu, 20 Nov 2014 14:05:39 -0800 Subject: [PATCH 084/138] 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> b) { + Number n1 = b.map(Box::get).get(); + Number n2 = b.map(Box::get).get(); + } + + interface Func { T apply(S arg); } + + interface Box { + T get(); + Box map(Func f); + } +} From 56e39629eb2d49a1b4b6cc86ee0c48d910c178b6 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Thu, 20 Nov 2014 14:23:31 -0800 Subject: [PATCH 085/138] 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?= Date: Fri, 21 Nov 2014 12:36:21 +0100 Subject: [PATCH 086/138] 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 a6355c5d7d2c600a3486a64ad2d4180510c6dff6 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Fri, 21 Nov 2014 16:05:46 +0100 Subject: [PATCH 087/138] 8058631: Rename posix to unix in build system to match file name changes Reviewed-by: simonis, erikj, tbell --- common/autoconf/basics.m4 | 8 +- common/autoconf/flags.m4 | 2 +- common/autoconf/generated-configure.sh | 260 ++++++++++++------------- common/autoconf/platform.m4 | 62 +++--- common/autoconf/spec.gmk.in | 13 +- make/CompileJavaModules.gmk | 6 +- make/Javadoc.gmk | 3 +- make/common/Modules.gmk | 6 +- make/common/NativeCompilation.gmk | 22 +-- 9 files changed, 187 insertions(+), 195 deletions(-) diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4 index c175085d30d..a7cf6c816a7 100644 --- a/common/autoconf/basics.m4 +++ b/common/autoconf/basics.m4 @@ -69,7 +69,7 @@ AC_DEFUN([BASIC_PREPEND_TO_PATH], # This will make sure the given variable points to a full and proper # path. This means: -# 1) There will be no spaces in the path. On posix platforms, +# 1) There will be no spaces in the path. On unix platforms, # spaces in the path will result in an error. On Windows, # the path will be rewritten using short-style to be space-free. # 2) The path will be absolute, and it will be in unix-style (on @@ -82,7 +82,7 @@ AC_DEFUN([BASIC_FIXUP_PATH], elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then BASIC_FIXUP_PATH_MSYS($1) else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="[$]$1" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -102,7 +102,7 @@ AC_DEFUN([BASIC_FIXUP_PATH], # This will make sure the given variable points to a executable # with a full and proper path. This means: -# 1) There will be no spaces in the path. On posix platforms, +# 1) There will be no spaces in the path. On unix platforms, # spaces in the path will result in an error. On Windows, # the path will be rewritten using short-style to be space-free. # 2) The path will be absolute, and it will be in unix-style (on @@ -118,7 +118,7 @@ AC_DEFUN([BASIC_FIXUP_EXECUTABLE], elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then BASIC_FIXUP_EXECUTABLE_MSYS($1) else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="[$]$1" diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4 index cd2d4a38eaa..cf73e40cedb 100644 --- a/common/autoconf/flags.m4 +++ b/common/autoconf/flags.m4 @@ -668,7 +668,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \ -I${JDK_TOPDIR}/src/java.base/share/native/include \ -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/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" # The shared libraries are compiled using the picflag. CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA" diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 23d5bcb1829..203bff0205b 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -908,7 +908,6 @@ ZERO_ARCHDEF DEFINE_CROSS_COMPILE_ARCH LP64 OPENJDK_TARGET_OS_EXPORT_DIR -OPENJDK_TARGET_OS_API_DIR OPENJDK_TARGET_CPU_JLI_CFLAGS OPENJDK_TARGET_CPU_OSARCH OPENJDK_TARGET_CPU_ISADIR @@ -923,14 +922,14 @@ OPENJDK_TARGET_CPU_BITS OPENJDK_TARGET_CPU_ARCH OPENJDK_TARGET_CPU OPENJDK_TARGET_OS_ENV -OPENJDK_TARGET_OS_API +OPENJDK_TARGET_OS_TYPE OPENJDK_TARGET_OS OPENJDK_BUILD_CPU_ENDIAN OPENJDK_BUILD_CPU_BITS OPENJDK_BUILD_CPU_ARCH OPENJDK_BUILD_CPU OPENJDK_BUILD_OS_ENV -OPENJDK_BUILD_OS_API +OPENJDK_BUILD_OS_TYPE OPENJDK_BUILD_OS OPENJDK_BUILD_AUTOCONF_NAME OPENJDK_TARGET_AUTOCONF_NAME @@ -3414,7 +3413,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # This will make sure the given variable points to a full and proper # path. This means: -# 1) There will be no spaces in the path. On posix platforms, +# 1) There will be no spaces in the path. On unix platforms, # spaces in the path will result in an error. On Windows, # the path will be rewritten using short-style to be space-free. # 2) The path will be absolute, and it will be in unix-style (on @@ -3424,7 +3423,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # This will make sure the given variable points to a executable # with a full and proper path. This means: -# 1) There will be no spaces in the path. On posix platforms, +# 1) There will be no spaces in the path. On unix platforms, # spaces in the path will result in an error. On Windows, # the path will be rewritten using short-style to be space-free. # 2) The path will be absolute, and it will be in unix-style (on @@ -4101,7 +4100,7 @@ pkgadd_help() { # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. # Converts autoconf style OS name to OpenJDK style, into -# VAR_OS and VAR_OS_API. +# VAR_OS, VAR_OS_TYPE and VAR_OS_ENV. # Expects $host_os $host_cpu $build_os and $build_cpu @@ -4330,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=1416323245 +DATE_WHEN_GENERATED=1416582260 ############################################################################### # @@ -13527,38 +13526,31 @@ test -n "$target_alias" && case "$build_os" in *linux*) VAR_OS=linux - VAR_OS_API=posix - VAR_OS_ENV=linux + VAR_OS_TYPE=unix ;; *solaris*) VAR_OS=solaris - VAR_OS_API=posix - VAR_OS_ENV=solaris + VAR_OS_TYPE=unix ;; *darwin*) VAR_OS=macosx - VAR_OS_API=posix - VAR_OS_ENV=macosx + VAR_OS_TYPE=unix ;; *bsd*) VAR_OS=bsd - VAR_OS_API=posix - VAR_OS_ENV=bsd + VAR_OS_TYPE=unix ;; *cygwin*) VAR_OS=windows - VAR_OS_API=winapi VAR_OS_ENV=windows.cygwin ;; *mingw*) VAR_OS=windows - VAR_OS_API=winapi VAR_OS_ENV=windows.msys ;; *aix*) VAR_OS=aix - VAR_OS_API=posix - VAR_OS_ENV=aix + VAR_OS_TYPE=unix ;; *) as_fn_error $? "unsupported operating system $build_os" "$LINENO" 5 @@ -13635,8 +13627,16 @@ test -n "$target_alias" && # ..and setup our own variables. (Do this explicitely to facilitate searching) OPENJDK_BUILD_OS="$VAR_OS" - OPENJDK_BUILD_OS_API="$VAR_OS_API" - OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV" + if test "x$VAR_OS_TYPE" != x; then + OPENJDK_BUILD_OS_TYPE="$VAR_OS_TYPE" + else + OPENJDK_BUILD_OS_TYPE="$VAR_OS" + fi + if test "x$VAR_OS_ENV" != x; then + OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV" + else + OPENJDK_BUILD_OS_ENV="$VAR_OS" + fi OPENJDK_BUILD_CPU="$VAR_CPU" OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH" OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS" @@ -13659,38 +13659,31 @@ $as_echo "$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU" >&6; } case "$host_os" in *linux*) VAR_OS=linux - VAR_OS_API=posix - VAR_OS_ENV=linux + VAR_OS_TYPE=unix ;; *solaris*) VAR_OS=solaris - VAR_OS_API=posix - VAR_OS_ENV=solaris + VAR_OS_TYPE=unix ;; *darwin*) VAR_OS=macosx - VAR_OS_API=posix - VAR_OS_ENV=macosx + VAR_OS_TYPE=unix ;; *bsd*) VAR_OS=bsd - VAR_OS_API=posix - VAR_OS_ENV=bsd + VAR_OS_TYPE=unix ;; *cygwin*) VAR_OS=windows - VAR_OS_API=winapi VAR_OS_ENV=windows.cygwin ;; *mingw*) VAR_OS=windows - VAR_OS_API=winapi VAR_OS_ENV=windows.msys ;; *aix*) VAR_OS=aix - VAR_OS_API=posix - VAR_OS_ENV=aix + VAR_OS_TYPE=unix ;; *) as_fn_error $? "unsupported operating system $host_os" "$LINENO" 5 @@ -13767,8 +13760,16 @@ $as_echo "$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU" >&6; } # ... and setup our own variables. (Do this explicitely to facilitate searching) OPENJDK_TARGET_OS="$VAR_OS" - OPENJDK_TARGET_OS_API="$VAR_OS_API" - OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV" + if test "x$VAR_OS_TYPE" != x; then + OPENJDK_TARGET_OS_TYPE="$VAR_OS_TYPE" + else + OPENJDK_TARGET_OS_TYPE="$VAR_OS" + fi + if test "x$VAR_OS_ENV" != x; then + OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV" + else + OPENJDK_TARGET_OS_ENV="$VAR_OS" + fi OPENJDK_TARGET_CPU="$VAR_CPU" OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH" OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS" @@ -13936,19 +13937,10 @@ $as_echo "$COMPILE_TYPE" >&6; } fi - # Setup OPENJDK_TARGET_OS_API_DIR, used in source paths. - if test "x$OPENJDK_TARGET_OS_API" = xposix; then - OPENJDK_TARGET_OS_API_DIR="unix" - fi - if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then - OPENJDK_TARGET_OS_API_DIR="windows" - fi - - if test "x$OPENJDK_TARGET_OS" = xmacosx; then OPENJDK_TARGET_OS_EXPORT_DIR=macosx else - OPENJDK_TARGET_OS_EXPORT_DIR=${OPENJDK_TARGET_OS_API_DIR} + OPENJDK_TARGET_OS_EXPORT_DIR=${OPENJDK_TARGET_OS_TYPE} fi @@ -14198,7 +14190,7 @@ $as_echo "$as_me: Rewriting CURDIR to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$CURDIR" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -14320,7 +14312,7 @@ $as_echo "$as_me: Rewriting TOPDIR to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$TOPDIR" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -14840,7 +14832,7 @@ $as_echo "$as_me: Rewriting with_devkit to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$with_devkit" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -15314,7 +15306,7 @@ $as_echo "$as_me: Rewriting OUTPUT_ROOT to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$OUTPUT_ROOT" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -15681,7 +15673,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$FOUND_MAKE" @@ -16054,7 +16046,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$FOUND_MAKE" @@ -16424,7 +16416,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$FOUND_MAKE" @@ -16799,7 +16791,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$FOUND_MAKE" @@ -17168,7 +17160,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$FOUND_MAKE" @@ -20335,7 +20327,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -20667,7 +20659,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -20861,7 +20853,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -21048,7 +21040,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -21234,7 +21226,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -21420,7 +21412,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -21597,7 +21589,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -21743,7 +21735,7 @@ $as_echo "$as_me: Rewriting JAVA_HOME_PROCESSED to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$JAVA_HOME_PROCESSED" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -21915,7 +21907,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -22243,7 +22235,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -22458,7 +22450,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -22638,7 +22630,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -22846,7 +22838,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -23026,7 +23018,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -23234,7 +23226,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -23414,7 +23406,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -23622,7 +23614,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -23802,7 +23794,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -23997,7 +23989,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -24175,7 +24167,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -24371,7 +24363,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -24549,7 +24541,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -24744,7 +24736,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -24922,7 +24914,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -25118,7 +25110,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -25296,7 +25288,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -25473,7 +25465,7 @@ $as_echo "$as_me: Rewriting BOOT_JDK to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$BOOT_JDK" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -27514,7 +27506,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$VS_ENV_CMD" @@ -28174,7 +28166,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$CC" @@ -28631,7 +28623,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$PROPER_COMPILER_CC" @@ -29914,7 +29906,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$CXX" @@ -30371,7 +30363,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$PROPER_COMPILER_CXX" @@ -31233,7 +31225,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$CPP" @@ -31648,7 +31640,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$CXXCPP" @@ -31992,7 +31984,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$LD" @@ -32487,7 +32479,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$AS" @@ -33115,7 +33107,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$AR" @@ -33651,7 +33643,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$OBJC" @@ -34119,7 +34111,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$LIPO" @@ -34460,7 +34452,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$MT" @@ -34797,7 +34789,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$RC" @@ -35116,7 +35108,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$DUMPBIN" @@ -35631,7 +35623,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$STRIP" @@ -36099,7 +36091,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$NM" @@ -36567,7 +36559,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$GNM" @@ -37036,7 +37028,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$MCS" @@ -37616,7 +37608,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$STRIP" @@ -38194,7 +38186,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$NM" @@ -38781,7 +38773,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$OBJCOPY" @@ -39365,7 +39357,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$OBJDUMP" @@ -39858,7 +39850,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$BUILD_CC" @@ -40326,7 +40318,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$BUILD_CXX" @@ -40794,7 +40786,7 @@ $as_echo "$as_me: You might be mixing spaces in the path and extra arguments, wh fi else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) # First separate the path from the arguments. This will split at the first # space. complete="$BUILD_LD" @@ -41346,7 +41338,7 @@ $as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$JT_HOME" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -41874,8 +41866,8 @@ done LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}" elif test "x$COMPILE_TYPE" = xreduced; then - if test "x$OPENJDK_TARGET_OS" != xwindows; then - # Specify -m if running reduced on other Posix platforms + if test "x$OPENJDK_TARGET_OS_TYPE" = xunix; then + # Specify -m if running reduced on unix platforms # When we add flags to the "official" CFLAGS etc, we need to # keep track of these additions in ADDED_CFLAGS etc. These @@ -42767,7 +42759,7 @@ fi COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \ -I${JDK_TOPDIR}/src/java.base/share/native/include \ -I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/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" # The shared libraries are compiled using the picflag. CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA" @@ -44753,7 +44745,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -44875,7 +44867,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -45106,7 +45098,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -45228,7 +45220,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -45720,7 +45712,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -45842,7 +45834,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -46048,7 +46040,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -46170,7 +46162,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -46367,7 +46359,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -46489,7 +46481,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -46686,7 +46678,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -46808,7 +46800,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -47006,7 +46998,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -47128,7 +47120,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -47327,7 +47319,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -47449,7 +47441,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -47644,7 +47636,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -47766,7 +47758,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -47961,7 +47953,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >& all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -48083,7 +48075,7 @@ $as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$POTENTIAL_FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -48261,7 +48253,7 @@ $as_echo "$as_me: Rewriting FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$FREETYPE_INCLUDE_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -48391,7 +48383,7 @@ $as_echo "$as_me: Rewriting FREETYPE_LIB_PATH to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$FREETYPE_LIB_PATH" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then @@ -50290,7 +50282,7 @@ $as_echo "$as_me: Rewriting MSVCR_DLL to \"$new_path\"" >&6;} all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") else - # We're on a posix platform. Hooray! :) + # We're on a unix platform. Hooray! :) path="$MSVCR_DLL" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then diff --git a/common/autoconf/platform.m4 b/common/autoconf/platform.m4 index 4eacb397cbe..27db8d047eb 100644 --- a/common/autoconf/platform.m4 +++ b/common/autoconf/platform.m4 @@ -98,44 +98,37 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU], # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. # Converts autoconf style OS name to OpenJDK style, into -# VAR_OS and VAR_OS_API. +# VAR_OS, VAR_OS_TYPE and VAR_OS_ENV. AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS], [ case "$1" in *linux*) VAR_OS=linux - VAR_OS_API=posix - VAR_OS_ENV=linux + VAR_OS_TYPE=unix ;; *solaris*) VAR_OS=solaris - VAR_OS_API=posix - VAR_OS_ENV=solaris + VAR_OS_TYPE=unix ;; *darwin*) VAR_OS=macosx - VAR_OS_API=posix - VAR_OS_ENV=macosx + VAR_OS_TYPE=unix ;; *bsd*) VAR_OS=bsd - VAR_OS_API=posix - VAR_OS_ENV=bsd + VAR_OS_TYPE=unix ;; *cygwin*) VAR_OS=windows - VAR_OS_API=winapi VAR_OS_ENV=windows.cygwin ;; *mingw*) VAR_OS=windows - VAR_OS_API=winapi VAR_OS_ENV=windows.msys ;; *aix*) VAR_OS=aix - VAR_OS_API=posix - VAR_OS_ENV=aix + VAR_OS_TYPE=unix ;; *) AC_MSG_ERROR([unsupported operating system $1]) @@ -165,14 +158,22 @@ AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD], PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu) # ..and setup our own variables. (Do this explicitely to facilitate searching) OPENJDK_BUILD_OS="$VAR_OS" - OPENJDK_BUILD_OS_API="$VAR_OS_API" - OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV" + if test "x$VAR_OS_TYPE" != x; then + OPENJDK_BUILD_OS_TYPE="$VAR_OS_TYPE" + else + OPENJDK_BUILD_OS_TYPE="$VAR_OS" + fi + if test "x$VAR_OS_ENV" != x; then + OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV" + else + OPENJDK_BUILD_OS_ENV="$VAR_OS" + fi OPENJDK_BUILD_CPU="$VAR_CPU" OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH" OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS" OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN" AC_SUBST(OPENJDK_BUILD_OS) - AC_SUBST(OPENJDK_BUILD_OS_API) + AC_SUBST(OPENJDK_BUILD_OS_TYPE) AC_SUBST(OPENJDK_BUILD_OS_ENV) AC_SUBST(OPENJDK_BUILD_CPU) AC_SUBST(OPENJDK_BUILD_CPU_ARCH) @@ -187,14 +188,22 @@ AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD], PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu) # ... and setup our own variables. (Do this explicitely to facilitate searching) OPENJDK_TARGET_OS="$VAR_OS" - OPENJDK_TARGET_OS_API="$VAR_OS_API" - OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV" + if test "x$VAR_OS_TYPE" != x; then + OPENJDK_TARGET_OS_TYPE="$VAR_OS_TYPE" + else + OPENJDK_TARGET_OS_TYPE="$VAR_OS" + fi + if test "x$VAR_OS_ENV" != x; then + OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV" + else + OPENJDK_TARGET_OS_ENV="$VAR_OS" + fi OPENJDK_TARGET_CPU="$VAR_CPU" OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH" OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS" OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN" AC_SUBST(OPENJDK_TARGET_OS) - AC_SUBST(OPENJDK_TARGET_OS_API) + AC_SUBST(OPENJDK_TARGET_OS_TYPE) AC_SUBST(OPENJDK_TARGET_OS_ENV) AC_SUBST(OPENJDK_TARGET_CPU) AC_SUBST(OPENJDK_TARGET_CPU_ARCH) @@ -331,19 +340,10 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS], fi AC_SUBST(OPENJDK_TARGET_CPU_JLI_CFLAGS) - # Setup OPENJDK_TARGET_OS_API_DIR, used in source paths. - if test "x$OPENJDK_TARGET_OS_API" = xposix; then - OPENJDK_TARGET_OS_API_DIR="unix" - fi - if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then - OPENJDK_TARGET_OS_API_DIR="windows" - fi - AC_SUBST(OPENJDK_TARGET_OS_API_DIR) - if test "x$OPENJDK_TARGET_OS" = xmacosx; then OPENJDK_TARGET_OS_EXPORT_DIR=macosx else - OPENJDK_TARGET_OS_EXPORT_DIR=${OPENJDK_TARGET_OS_API_DIR} + OPENJDK_TARGET_OS_EXPORT_DIR=${OPENJDK_TARGET_OS_TYPE} fi AC_SUBST(OPENJDK_TARGET_OS_EXPORT_DIR) @@ -472,8 +472,8 @@ AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS], # And -q on AIX because otherwise the compiler produces 32-bit objects by default PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS elif test "x$COMPILE_TYPE" = xreduced; then - if test "x$OPENJDK_TARGET_OS" != xwindows; then - # Specify -m if running reduced on other Posix platforms + if test "x$OPENJDK_TARGET_OS_TYPE" = xunix; then + # Specify -m if running reduced on unix platforms PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS fi fi diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index e5b43ecdafb..bcf30a98a5a 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -82,7 +82,7 @@ CONF_NAME:=@CONF_NAME@ # The built jdk will run in this target system. OPENJDK_TARGET_OS:=@OPENJDK_TARGET_OS@ -OPENJDK_TARGET_OS_API:=@OPENJDK_TARGET_OS_API@ +OPENJDK_TARGET_OS_TYPE:=@OPENJDK_TARGET_OS_TYPE@ OPENJDK_TARGET_OS_ENV:=@OPENJDK_TARGET_OS_ENV@ OPENJDK_TARGET_CPU:=@OPENJDK_TARGET_CPU@ @@ -99,13 +99,12 @@ OPENJDK_TARGET_CPU_LEGACY:=@OPENJDK_TARGET_CPU_LEGACY@ OPENJDK_TARGET_CPU_LEGACY_LIB:=@OPENJDK_TARGET_CPU_LEGACY_LIB@ OPENJDK_TARGET_CPU_OSARCH:=@OPENJDK_TARGET_CPU_OSARCH@ OPENJDK_TARGET_CPU_JLI_CFLAGS:=@OPENJDK_TARGET_CPU_JLI_CFLAGS@ -OPENJDK_TARGET_OS_API_DIR:=@OPENJDK_TARGET_OS_API_DIR@ OPENJDK_TARGET_OS_EXPORT_DIR:=@OPENJDK_TARGET_OS_EXPORT_DIR@ # We are building on this build system. # When not cross-compiling, it is the same as the target. OPENJDK_BUILD_OS:=@OPENJDK_BUILD_OS@ -OPENJDK_BUILD_OS_API:=@OPENJDK_BUILD_OS_API@ +OPENJDK_BUILD_OS_TYPE:=@OPENJDK_BUILD_OS_TYPE@ OPENJDK_BUILD_OS_ENV:=@OPENJDK_BUILD_OS_ENV@ OPENJDK_BUILD_CPU:=@OPENJDK_BUILD_CPU@ @@ -351,7 +350,7 @@ OBJC:=@CCACHE@ @OBJC@ CPP:=@FIXPATH@ @CPP@ #CPPFLAGS:=@CPPFLAGS@ -# The linker can be gcc or ld on posix systems, or link.exe on windows systems. +# The linker can be gcc or ld on unix systems, or link.exe on windows systems. LD:=@FIXPATH@ @LD@ # Xcode SDK path @@ -392,7 +391,7 @@ BUILD_LD:=@FIXPATH@ @BUILD_LD@ AS:=@FIXPATH@ @AS@ -# AR is used to create a static library (is ar in posix, lib.exe in windows) +# AR is used to create a static library (is ar in unix, lib.exe in windows) AR:=@FIXPATH@ @AR@ ARFLAGS:=@ARFLAGS@ @@ -569,10 +568,10 @@ FIXPATH:=@FIXPATH@ # Where the build output is stored for your convenience. BUILD_LOG:=@BUILD_LOG@ BUILD_LOG_PREVIOUS:=@BUILD_LOG_PREVIOUS@ -# Disable the build log wrapper on sjavac+winapi until +# Disable the build log wrapper on sjavac+windows until # we have solved how to prevent the log wrapper to wait # for the background sjavac server process. -ifeq (@ENABLE_SJAVAC@X@OPENJDK_BUILD_OS_API@,yesXwinapi) +ifeq (@ENABLE_SJAVAC@X@OPENJDK_BUILD_OS@,yesXwindows) BUILD_LOG_WRAPPER:= else BUILD_LOG_WRAPPER:=@BUILD_LOG_WRAPPER@ diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk index 20ae9c9f073..b8f792d3c3d 100644 --- a/make/CompileJavaModules.gmk +++ b/make/CompileJavaModules.gmk @@ -433,8 +433,8 @@ GENERATED_SRC_DIRS += \ # OS_SRC_DIRS += $(JDK_TOPDIR)/src/$1/$(OPENJDK_TARGET_OS)/classes -ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_API_DIR)) -OS_API_SRC_DIRS += $(JDK_TOPDIR)/src/$1/$(OPENJDK_TARGET_OS_API_DIR)/classes +ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE)) + OS_TYPE_SRC_DIRS += $(JDK_TOPDIR)/src/$1/$(OPENJDK_TARGET_OS_TYPE)/classes endif SHARE_SRC_DIRS += \ @@ -448,7 +448,7 @@ SHARE_SRC_DIRS += \ ALL_SRC_DIRS = \ $(GENERATED_SRC_DIRS) \ $(OS_SRC_DIRS) \ - $(OS_API_SRC_DIRS) \ + $(OS_TYPE_SRC_DIRS) \ $(SHARE_SRC_DIRS) \ # diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk index 4ba011d15d8..cba9d666ad2 100644 --- a/make/Javadoc.gmk +++ b/make/Javadoc.gmk @@ -137,7 +137,8 @@ $(FULL_COMPANY_NAME) in the US and other countries. # command (newline or shell ; character) ALL_SOURCE_DIRS := $(wildcard \ $(JDK_TOPDIR)/src/*/share/classes \ - $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_API_DIR)/classes \ + $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \ + $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_TYPE)/classes \ $(LANGTOOLS_TOPDIR)/src/*/share/classes \ $(CORBA_TOPDIR)/src/*/share/classes \ $(JAXP_TOPDIR)/src/*/share/classes \ diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk index 16bb629313e..3ef5c01f4bd 100644 --- a/make/common/Modules.gmk +++ b/make/common/Modules.gmk @@ -46,8 +46,8 @@ define FindJavaModules $(filter-out $(JAVA_MODULES_FILTER), $(sort $(notdir \ $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir \ $(wildcard $(patsubst %,%/*/share/classes/*, $(ALL_TOP_SRC_DIRS)) \ - $(patsubst %,%/*/$(OPENJDK_TARGET_OS_API_DIR)/classes/*, $(ALL_TOP_SRC_DIRS)) \ - $(patsubst %,%/*/$(OPENJDK_TARGET_OS)/classes/*, $(ALL_TOP_SRC_DIRS)))))))))))) + $(patsubst %,%/*/$(OPENJDK_TARGET_OS)/classes/*, $(ALL_TOP_SRC_DIRS)) \ + $(patsubst %,%/*/$(OPENJDK_TARGET_OS_TYPE)/classes/*, $(ALL_TOP_SRC_DIRS)))))))))))) endef # Find all modules with source for the target platform. @@ -55,7 +55,7 @@ define FindAllModules $(sort $(filter-out closed demo sample, $(notdir $(patsubst %/,%, $(dir \ $(wildcard $(patsubst %, %/*/share, $(ALL_TOP_SRC_DIRS)) \ $(patsubst %, %/*/$(OPENJDK_TARGET_OS), $(ALL_TOP_SRC_DIRS)) \ - $(patsubst %, %/*/$(OPENJDK_TARGET_OS_API_DIR), $(ALL_TOP_SRC_DIRS)))))))) + $(patsubst %, %/*/$(OPENJDK_TARGET_OS_TYPE), $(ALL_TOP_SRC_DIRS)))))))) endef ################################################################################ diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index fe82cd2730e..3f0e5ecd934 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -308,29 +308,29 @@ define SetupNativeCompilation $$(shell $(RM) -f $$($1_SUPERFLUOUS_OBJS)) endif - # Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables for CFLAGS. - $1_EXTRA_CFLAGS:=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_API)) $$($1_CFLAGS_$(OPENJDK_TARGET_OS)) + # Pickup extra OPENJDK_TARGET_OS_TYPE and/or OPENJDK_TARGET_OS dependent variables for CFLAGS. + $1_EXTRA_CFLAGS:=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_CFLAGS_$(OPENJDK_TARGET_OS)) ifneq ($(DEBUG_LEVEL),release) # Pickup extra debug dependent variables for CFLAGS $1_EXTRA_CFLAGS+=$$($1_CFLAGS_debug) - $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_API)_debug) + $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_TYPE)_debug) $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS)_debug) else $1_EXTRA_CFLAGS+=$$($1_CFLAGS_release) - $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_API)_release) + $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_TYPE)_release) $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS)_release) endif - # Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables for CXXFLAGS. - $1_EXTRA_CXXFLAGS:=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_API)) $$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)) + # Pickup extra OPENJDK_TARGET_OS_TYPE and/or OPENJDK_TARGET_OS dependent variables for CXXFLAGS. + $1_EXTRA_CXXFLAGS:=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)) ifneq ($(DEBUG_LEVEL),release) # Pickup extra debug dependent variables for CXXFLAGS $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_debug) - $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_API)_debug) + $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_TYPE)_debug) $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)_debug) else $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_release) - $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_API)_release) + $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_TYPE)_release) $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)_release) endif @@ -420,10 +420,10 @@ define SetupNativeCompilation endif endif - # Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables + # Pickup extra OPENJDK_TARGET_OS_TYPE and/or OPENJDK_TARGET_OS dependent variables # for LDFLAGS and LDFLAGS_SUFFIX - $1_EXTRA_LDFLAGS:=$$($1_LDFLAGS_$(OPENJDK_TARGET_OS_API)) $$($1_LDFLAGS_$(OPENJDK_TARGET_OS)) - $1_EXTRA_LDFLAGS_SUFFIX:=$$($1_LDFLAGS_SUFFIX_$(OPENJDK_TARGET_OS_API)) $$($1_LDFLAGS_SUFFIX_$(OPENJDK_TARGET_OS)) + $1_EXTRA_LDFLAGS:=$$($1_LDFLAGS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LDFLAGS_$(OPENJDK_TARGET_OS)) + $1_EXTRA_LDFLAGS_SUFFIX:=$$($1_LDFLAGS_SUFFIX_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LDFLAGS_SUFFIX_$(OPENJDK_TARGET_OS)) ifneq (,$$($1_REAL_MAPFILE)) $1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE)) endif From 78df8f34ba06fc61a9c54d5cd012011d7921bfa9 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Fri, 21 Nov 2014 16:11:28 +0100 Subject: [PATCH 088/138] 8065215: Print warning summary at end of configure Reviewed-by: erikj, tbell --- common/autoconf/configure.ac | 1 + common/autoconf/generated-configure.sh | 22 ++++++++++++++++++---- common/autoconf/help.m4 | 20 +++++++++++++++++--- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/common/autoconf/configure.ac b/common/autoconf/configure.ac index 481d328a1c4..146556f479e 100644 --- a/common/autoconf/configure.ac +++ b/common/autoconf/configure.ac @@ -275,3 +275,4 @@ $CHMOD +x $OUTPUT_ROOT/compare.sh # Finally output some useful information to the user HELP_PRINT_SUMMARY_AND_WARNINGS CUSTOM_SUMMARY_AND_WARNINGS_HOOK +HELP_REPEAT_WARNINGS diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 203bff0205b..8b55a8f40fa 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -3971,6 +3971,8 @@ pkgadd_help() { + + # # Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -4329,7 +4331,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=1416582260 +DATE_WHEN_GENERATED=1416582658 ############################################################################### # @@ -52427,15 +52429,15 @@ $CHMOD +x $OUTPUT_ROOT/compare.sh printf "====================================================\n" if test "x$no_create" != "xyes"; then if test "x$IS_RECONFIGURE" != "xyes"; then - printf "A new configuration has been successfully created in\n %s\n" "$OUTPUT_ROOT" + printf "A new configuration has been successfully created in\n%s\n" "$OUTPUT_ROOT" else - printf "The existing configuration has been successfully updated in\n %s\n" "$OUTPUT_ROOT" + printf "The existing configuration has been successfully updated in\n%s\n" "$OUTPUT_ROOT" fi else if test "x$IS_RECONFIGURE" != "xyes"; then printf "A configuration has been successfully checked but not created\n" else - printf "The existing configuration has been successfully checked in\n %s\n" "$OUTPUT_ROOT" + printf "The existing configuration has been successfully checked in\n%s\n" "$OUTPUT_ROOT" fi fi if test "x$CONFIGURE_COMMAND_LINE" != x; then @@ -52507,3 +52509,15 @@ $CHMOD +x $OUTPUT_ROOT/compare.sh fi + +if test -e "$OUTPUT_ROOT/config.log"; then + $GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" > /dev/null 2>&1 + if test $? -eq 0; then + printf "The following warnings were produced. Repeated here for convenience:\n" + # We must quote sed expression (using []) to stop m4 from eating the []. + $GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" | $SED -e 's/^configure:[0-9]*: //' + printf "\n" + fi +fi + + diff --git a/common/autoconf/help.m4 b/common/autoconf/help.m4 index 90882332a9d..9e7fb73d9ef 100644 --- a/common/autoconf/help.m4 +++ b/common/autoconf/help.m4 @@ -178,15 +178,15 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS], printf "====================================================\n" if test "x$no_create" != "xyes"; then if test "x$IS_RECONFIGURE" != "xyes"; then - printf "A new configuration has been successfully created in\n %s\n" "$OUTPUT_ROOT" + printf "A new configuration has been successfully created in\n%s\n" "$OUTPUT_ROOT" else - printf "The existing configuration has been successfully updated in\n %s\n" "$OUTPUT_ROOT" + printf "The existing configuration has been successfully updated in\n%s\n" "$OUTPUT_ROOT" fi else if test "x$IS_RECONFIGURE" != "xyes"; then printf "A configuration has been successfully checked but not created\n" else - printf "The existing configuration has been successfully checked in\n %s\n" "$OUTPUT_ROOT" + printf "The existing configuration has been successfully checked in\n%s\n" "$OUTPUT_ROOT" fi fi if test "x$CONFIGURE_COMMAND_LINE" != x; then @@ -257,3 +257,17 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS], printf "\n" fi ]) + +AC_DEFUN_ONCE([HELP_REPEAT_WARNINGS], +[ +if test -e "$OUTPUT_ROOT/config.log"; then + $GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" > /dev/null 2>&1 + if test $? -eq 0; then + printf "The following warnings were produced. Repeated here for convenience:\n" + # We must quote sed expression (using []) to stop m4 from eating the []. + $GREP '^configure:.*: WARNING:' "$OUTPUT_ROOT/config.log" | $SED -e [ 's/^configure:[0-9]*: //' ] + printf "\n" + fi +fi + +]) From b5ae347f9c3b048ec27d0099d7ea19af16429b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Fri, 21 Nov 2014 17:44:57 +0100 Subject: [PATCH 089/138] 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 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 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 { 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 initConstructorAndSwitchPoint(final String name, final Class 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.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:3:8 Variable "x" has already been declared var x = {}; ^ -SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8:2:8 Variable "x" has already been declared - var x = 2; - ^ -SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8:2:13 Variable "x" has already been declared - function x () {} - ^ +SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8:3:10 Variable "x" has already been declared + const x = {}; + ^ +SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8: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:2:8 Variabl SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8:3:8 Variable "x" has already been declared var x = 2; ^ -SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8:2:8 Variable "x" has already been declared - var x = 2; +SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8:3:8 Variable "x" has already been declared + let x = undefined; ^ SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8:2:10 Variable "x" has already been declared const x = function (){}; ^ -SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8:3:13 Variable "a" has already been declared - function a () {}; - ^ +SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8: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 bdf693fcc5740e3dacee5b8bea8d16bb43d5d6a9 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Fri, 21 Nov 2014 10:38:43 -0800 Subject: [PATCH 090/138] 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 path); + protected abstract String inferBinaryName(Iterable 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 getJarClassPath(File file) throws IOException { + public List 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> ? - private Map cache = new ConcurrentHashMap<>(); + private final Map cache = new ConcurrentHashMap<>(); private static class Entry { - File canonicalFile; + Path canonicalFile; boolean exists; boolean isFile; boolean isDirectory; - List jarClassPath; + List 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 getJarClassPath(File file) throws IOException { - String parent = file.getParent(); - try (JarFile jarFile = new JarFile(file)) { + public List 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 list = new ArrayList<>(); + List 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 { + protected enum SortFiles implements Comparator { 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 fileKinds, boolean recurse, ListBuffer 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 files; + try (Stream 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 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 archives = new HashMap<>(); + Map 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 path = getLocation(location); + Iterable path = asPaths(getLocation(location)); if (path == null) return List.nil(); RelativeDirectory subdirectory = RelativeDirectory.forPackage(packageName); ListBuffer 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 path = getLocation(location); + Iterable 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 path = getLocation(location); + Iterable 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 path = locations.getLocation(location); + Iterable 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 path) + Iterable searchpath) throws IOException { nullCheck(location); - locations.setLocation(location, path); + locations.setLocation(location, asPaths(searchpath)); } @DefinedBy(Api.COMPILER) public Iterable getLocation(Location location) { + nullCheck(location); + return asFiles(locations.getLocation(location)); + } + + private Iterable 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 asPaths(final Iterable files) { + if (files == null) + return null; + + return () -> new Iterator() { + Iterator iter = files.iterator(); + + @Override + public boolean hasNext() { + return iter.hasNext(); + } + + @Override + public Path next() { + return iter.next().toPath(); + } + }; + } + + static Iterable asFiles(final Iterable paths) { + if (paths == null) + return null; + + return () -> new Iterator() { + Iterator 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 bootClassPath() { + public Collection 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 userClassPath() { + public Collection userClassPath() { return getLocation(CLASS_PATH); } - public Collection sourcePath() { - Collection p = getLocation(SOURCE_PATH); + public Collection sourcePath() { + Collection 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 getPathEntries(String path) { - return getPathEntries(path, null); + private static Iterable 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 getPathEntries(String path, File emptyPathDefault) { - ListBuffer 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 getPathEntries(String searchPath, Path emptyPathDefault) { + ListBuffer 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 { + private class SearchPath extends LinkedHashSet { private static final long serialVersionUID = 0; private boolean expandJarClassPaths = false; - private final Set canonicalValues = new HashSet<>(); + private final Set 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 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 files, boolean warn) { + public SearchPath addFiles(Iterable files, boolean warn) { if (files != null) { - for (File file : files) { + for (Path file : files) { addFile(file, warn); } } return this; } - public SearchPath addFiles(Iterable files) { + public SearchPath addFiles(Iterable 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 getLocation(); + abstract Collection getLocation(); /** * @see StandardJavaFileManager#setLocation */ - abstract void setLocation(Iterable files) throws IOException; + abstract void setLocation(Iterable 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 getLocation() { + Collection getLocation() { return (outputDir == null) ? null : Collections.singleton(outputDir); } @Override - void setLocation(Iterable files) throws IOException { + void setLocation(Iterable files) throws IOException { if (files == null) { outputDir = null; } else { - Iterator pathIter = files.iterator(); + Iterator 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 searchPath; + protected Collection searchPath; SimpleLocationHandler(Location location, Option... options) { super(location, options); @@ -452,12 +448,12 @@ public class Locations { } @Override - Collection getLocation() { + Collection getLocation() { return searchPath; } @Override - void setLocation(Iterable files) { + void setLocation(Iterable files) { SearchPath p; if (files == null) { p = computePath(null); @@ -488,7 +484,7 @@ public class Locations { } @Override - Collection getLocation() { + Collection 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 searchPath; + private Collection searchPath; final Map 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 getLocation() { + Collection getLocation() { lazy(); return searchPath; } @Override - void setLocation(Iterable files) { + void setLocation(Iterable 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 getLocation(Location location) { + Collection 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 files) throws IOException { + void setLocation(Location location, Iterable 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 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 absFileRef; + final Path file; + private Reference 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 path) { - String fPath = file.getPath(); + protected String inferBinaryName(Iterable 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 { 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 path) { + protected String inferBinaryName(Iterable 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; /** *

    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 absFileRef; + protected Reference 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 path) { + protected String inferBinaryName(Iterable 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.emptySet(); // ZipFileIndex data entries - final File zipFile; - private Reference absFileRef; + final Path zipFile; + private Reference 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 path) { + protected String inferBinaryName(Iterable 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 map = new HashMap<>(); + private final Map 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 path) { + protected String inferBinaryName(Iterable 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 files = null; + Collection 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 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 { 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 { } } + /** + * Run the test in a separate process. + */ + static class ExecCompiler extends Compiler { + ExecCompiler(boolean verbose) { + super(verbose); + } + + @Override + boolean run(PrintWriter out, Set keys, boolean raw, List opts, List files) { + if (out != null && keys != null) + throw new IllegalArgumentException(); + + if (verbose) + System.err.println("run_exec: " + opts + " " + files); + + List args = new ArrayList(); + + 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 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 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 590188542edb27c21a6e48ca863404fa13de485d Mon Sep 17 00:00:00 2001 From: Eric McCorkle Date: Fri, 21 Nov 2014 16:36:39 -0500 Subject: [PATCH 091/138] 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 params, + RetentionPolicy retention) { + for (VarSymbol s : params) { + ListBuffer 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 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 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 annoMatcher(ConstantPool cpool) { + return new Attribute.Visitor() { + + @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 paramMatcher(ConstantPool cpool) { + return new Attribute.Visitor() { + + @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( + "", + 0, + "A", + true, + 0), + (ExpectedParameterAnnotation) + // Assert there is an annotation on the + // first parameter. + new ExpectedParameterAnnotation( + "", + 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( + "", + 0, + "B", + false, + 0), + (ExpectedParameterAnnotation) + // Assert there is an annotation on the + // first parameter. + new ExpectedParameterAnnotation( + "", + 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( + "", + 0, + "A", + true, + 0), + (ExpectedParameterAnnotation) + // Assert there is no annotation on the + // $enum$ordinal parameter. + new ExpectedParameterAnnotation( + "", + 1, + "A", + true, + 0), + (ExpectedParameterAnnotation) + // Assert there is an annotation on the + // first parameter. + new ExpectedParameterAnnotation( + "", + 2, + "A", + true, + 1), + (ExpectedParameterAnnotation) + // Assert there is no annotation on the + // $enum$name parameter. + new ExpectedParameterAnnotation( + "", + 0, + "B", + false, + 0), + (ExpectedParameterAnnotation) + // Assert there is no annotation on the + // $enum$ordinal parameter. + new ExpectedParameterAnnotation( + "", + 1, + "B", + false, + 0), + (ExpectedParameterAnnotation) + // Assert there is an annotation on the + // first parameter. + new ExpectedParameterAnnotation( + "", + 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 65d007d4453723bfcfe07edeb9a00a66ea869b4a Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Mon, 24 Nov 2014 11:53:47 +0100 Subject: [PATCH 092/138] 8065138: Encodings.isRecognizedEnconding sometimes fails to recognize 'UTF8' Reviewed-by: dfuchs --- make/common/JavaCompilation.gmk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk index 5c3ea73ca7d..1f6d5f501f5 100644 --- a/make/common/JavaCompilation.gmk +++ b/make/common/JavaCompilation.gmk @@ -400,13 +400,15 @@ define add_file_to_clean # Now we can setup the depency that will trigger the copying. $$($1_BIN)$$($2_TARGET) : $2 $(MKDIR) -p $$(@D) - $(CAT) $$< | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \ + export LC_ALL=C ; $(CAT) $$< \ + | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \ -e 's/\([^\\]\)!/\1\\!/g' -e 's/#.*/#/g' \ | $(SED) -f "$(SRC_ROOT)/make/common/support/unicode2x.sed" \ | $(SED) -e '/^#/d' -e '/^$$$$/d' \ -e :a -e '/\\$$$$/N; s/\\\n//; ta' \ -e 's/^[ ]*//;s/[ ]*$$$$//' \ - -e 's/\\=/=/' | LC_ALL=C $(SORT) > $$@ + -e 's/\\=/=/' \ + | $(SORT) > $$@ $(CHMOD) -f ug+w $$@ # And do not forget this target From e9f4e57a6b6aa72a533d39c2c7470663991bca1c Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 26 Nov 2014 14:59:10 +0100 Subject: [PATCH 093/138] 8065911: Introduce EvalDebugWrapper for all Setup* macros Reviewed-by: erikj --- make/common/IdlCompilation.gmk | 23 +++- make/common/JavaCompilation.gmk | 188 ++++++++++++----------------- make/common/MakeBase.gmk | 11 ++ make/common/NativeCompilation.gmk | 61 ++++++---- make/common/RMICompilation.gmk | 31 +++-- make/common/TextFileProcessing.gmk | 24 ++-- make/common/ZipArchive.gmk | 113 +++++++++++++++++ 7 files changed, 286 insertions(+), 165 deletions(-) create mode 100644 make/common/ZipArchive.gmk diff --git a/make/common/IdlCompilation.gmk b/make/common/IdlCompilation.gmk index d816f23e613..3fdf979d154 100644 --- a/make/common/IdlCompilation.gmk +++ b/make/common/IdlCompilation.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2012, 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 @@ -75,10 +75,25 @@ define add_idl_package $(RM) -rf $3/$$($4_TMPDIR) endef +# Setup make rules for creating an IDL compilation. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: +# IDLJ +# SRC +# BIN +# INCLUDES +# EXCLUDES +# OLDIMPLBASES +# DELETES define SetupIdlCompilation - # param 1 is for example BUILD_IDLS - # param 2,3,4,5,6,7,8 are named args. - # IDLJ,SRC,BIN,INCLUDES,EXCLUDES,OLDIMPLBASES,DELETES + $(if $(16),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk)) + $(call EvalDebugWrapper,$(strip $1),$(call SetupIdlCompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))) +endef + +define SetupIdlCompilationInner $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) $(call LogSetupMacroEntry,SetupIdlCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) $(if $(16),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk)) diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk index 1f6d5f501f5..27846c0a924 100644 --- a/make/common/JavaCompilation.gmk +++ b/make/common/JavaCompilation.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 @@ -42,17 +42,29 @@ ifeq (,$(_MAKEBASE_GMK)) $(error You must include MakeBase.gmk prior to including JavaCompilation.gmk) endif +# Java compilation needs SetupZipArchive if we're generating a source zip. +include ZipArchive.gmk + FALSE_FIND_PATTERN:=-name FILE_NAME_THAT_DOESNT_EXIST +# Setup make rules for defining a Java compiler, which is needed to compile +# Java code. This rule generates no output. +# +# Parameter 1 is the name of the compiler definition. This name needs to be +# passed to SetupJavaCompilation. This name is used as variable prefix. +# +# Remaining parameters are named arguments. These include: +# JVM:=The jvm used to run the javac/javah command +# JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out +# FLAGS:=Flags to be supplied to javac +# SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here +# SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above. define SetupJavaCompiler - # param 1 is for example GENERATE_OLD_BYTECODE or GENERATE_NEW_JDKBYTECODE - # This is the name of the compiler setup. - # param 2-9 are named args. - # JVM:=The jvm used to run the javac/javah command - # JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out - # FLAGS:=Flags to be supplied to javac - # SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here - # SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above. + $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk)) + $(call EvalDebugWrapper,$(strip $1),$(call SetupJavaCompilerInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))) +endef + +define SetupJavaCompilerInner $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) $(call LogSetupMacroEntry,SetupJavaCompiler($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk)) @@ -67,25 +79,32 @@ define SetupJavaCompiler endif endef +# Setup make rules for creating a jar archive. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: +# SRCS:=List of directories in where to find files to add to archive +# SUFFIXES:=File suffixes to include in jar +# INCLUDES:=List of directories/packages in SRCS that should be included +# EXCLUDES:=List of directories/packages in SRCS that should be excluded +# EXCLUDE_FILES:=List of files in SRCS that should be excluded +# EXTRA_FILES:=List of files in SRCS that should be included regardless of suffix match. +# JAR:=Jar file to create +# MANIFEST:=Optional manifest file template. +# JARMAIN:=Optional main class to add to manifest +# JARINDEX:=true means generate the index in the jar file. +# SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically +# added to the archive. +# EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest. +# CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable define SetupArchive - # param 1 is for example ARCHIVE_MYPACKAGE - # param 2 are the dependecies - # param 3,4,5,6,7,8,9 are named args. - # SRCS:=List of directories in where to find files to add to archive - # SUFFIXES:=File suffixes to include in jar - # INCLUDES:=List of directories/packages in SRCS that should be included - # EXCLUDES:=List of directories/packages in SRCS that should be excluded - # EXCLUDE_FILES:=List of files in SRCS that should be excluded - # EXTRA_FILES:=List of files in SRCS that should be included regardless of suffix match. - # JAR:=Jar file to create - # MANIFEST:=Optional manifest file template. - # JARMAIN:=Optional main class to add to manifest - # JARINDEX:=true means generate the index in the jar file. - # SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically - # added to the archive. - # EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest. - # CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable + $(if $(16),$(error Internal makefile error: Too many arguments to SetupArchive, please update JavaCompilation.gmk)) + $(call EvalDebugWrapper,$(strip $1),$(call SetupArchiveInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))) +endef +define SetupArchiveInner # NOTE: $2 is dependencies, not a named argument! $(foreach i,3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) $(call LogSetupMacroEntry,SetupArchive($1),,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) @@ -287,69 +306,6 @@ define SetupArchive $1 += $$($1_JAR) endef -define SetupZipArchive - # param 1 is for example ZIP_MYSOURCE - # param 2,3,4,5,6,7,8,9 are named args. - # SRC,ZIP,INCLUDES,INCLUDE_FILES,EXCLUDES,EXCLUDE_FILES,SUFFIXES,EXTRA_DEPS - $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) - $(call LogSetupMacroEntry,SetupZipArchive($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) - $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk)) - - # To avoid running find over too large sets of files, which causes make to crash - # on some configurations (cygwin), use INCLUDES and INCLUDE_FILES to build a set - # of directories to run find in, if available. - ifneq ($$($1_INCLUDES)$$($1_INCLUDE_FILES),) - $1_FIND_LIST := $$(wildcard $$(foreach i,$$($1_SRC), \ - $$(addprefix $$i/,$$($1_INCLUDES) $$($1_INCLUDE_FILES)))) - else - $1_FIND_LIST := $$($1_SRC) - endif - - # Find all files in the source tree. - $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST))) - - # Filter on suffixes if set - ifneq ($$($1_SUFFIXES),) - $1_ALL_SRCS := $$(filter $$(addprefix %, $$($1_SUFFIXES)), $$($1_ALL_SRCS)) - endif - - ifneq ($$($1_INCLUDES),) - ifneq ($$($1_SUFFIXES),) - $1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES), \ - $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES)))) - else - $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES))) - endif - endif - ifneq ($$($1_INCLUDE_FILES),) - $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_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($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)) - - # Now $1_ALL_SRCS should contain all sources that are going to be put into the zip. - # I.e. the zip -i and -x options should match the filtering done in the makefile. - # Explicitly excluded files can be given with absolute path. The patsubst solution - # isn't perfect but the likelyhood of an absolute path to match something in a src - # dir is very small. - # If zip has nothing to do, it returns 12 and would fail the build. Check for 12 - # and only fail if it's not. - $$($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 - $(TOUCH) $$@ - - # Add zip to target list - $1 += $$($1_ZIP) -endef - define add_file_to_copy # param 1 = BUILD_MYPACKAGE # parma 2 = The source file to copy. @@ -423,29 +379,39 @@ 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. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: +# SETUP:=must point to a previously setup java compiler, for example: SETUP:=BOOTJAVAC +# JVM:=path to ..bin/java +# ADD_JAVAC_FLAGS:=javac flags to append to the default ones. +# SRC:=one or more directories to search for sources +# BIN:=store classes here +# INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages. +# EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages. +# COPY:=.prp means copy all prp files to the corresponding package in BIN. +# COPY_FILES:=myapp/foo/setting.txt means copy this file over to the package myapp/foo +# CLEAN:=.properties means copy and clean all properties file to the corresponding package in BIN. +# CLEAN_FILES:=myapp/foo/setting.txt means clean this file over to the package myapp/foo +# SRCZIP:=Create a src.zip based on the found sources and copied files. +# 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. define SetupJavaCompilation - # param 1 is for example BUILD_MYPACKAGE - # param 2,3,4,5,6,7,8 are named args. - # SETUP:=must point to a previously setup java compiler, for example: SETUP:=BOOTJAVAC - # JVM:=path to ..bin/java - # ADD_JAVAC_FLAGS:=javac flags to append to the default ones. - # SRC:=one or more directories to search for sources - # BIN:=store classes here - # INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages. - # EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages. - # COPY:=.prp means copy all prp files to the corresponding package in BIN. - # COPY_FILES:=myapp/foo/setting.txt means copy this file over to the package myapp/foo - # CLEAN:=.properties means copy and clean all properties file to the corresponding package in BIN. - # CLEAN_FILES:=myapp/foo/setting.txt means clean this file over to the package myapp/foo - # SRCZIP:=Create a src.zip based on the found sources and copied files. - # 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. + $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk)) + $(call EvalDebugWrapper,$(strip $1),$(call SetupJavaCompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))) +endef + +define SetupJavaCompilationInner $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) $(call LogSetupMacroEntry,SetupJavaCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk)) diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index b23cd83d8b0..ee02322a2d4 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -380,6 +380,17 @@ define LogSetupMacroEntry $(if $(findstring $(LOG_LEVEL),debug trace), $(info $1 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26,$(if $($i),$(NEWLINE) $(strip [$i] $($i)))))) endef +# Support macro for all SetupFoo macros. +define EvalDebugWrapper + $(if $(DEBUG_$1), + $(info -------- <<< Begin expansion of $1) + $(info $2) + $(info -------- >>> End expansion of $1) + ) + + $2 +endef + # Make directory without forking mkdir if not needed define MakeDir ifneq ($$(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),$$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9)) diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index 3f0e5ecd934..550b58e8064 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -134,32 +134,43 @@ define add_native_source endif endef +# Setup make rules for creating a native binary (a shared library or an +# executable). +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: +# SRC one or more directory roots to scan for C/C++ files. +# LANG C or C++ +# CFLAGS the compiler flags to be used, used both for C and C++. +# CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS. +# LDFLAGS the linker flags to be used, used both for C and C++. +# LDFLAGS_SUFFIX the linker flags to be added last on the commandline +# typically the libraries linked to. +# ARFLAGS the archiver flags to be used +# OBJECT_DIR the directory where we store the object files +# LIBRARY the resulting library file +# PROGRAM the resulting exec file +# INCLUDES only pick source from these directories +# EXCLUDES do not pick source from these directories +# INCLUDE_FILES only compile exactly these files! +# EXCLUDE_FILES with these names +# EXTRA_FILES List of extra files not in any of the SRC dirs +# VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run +# RC_FLAGS flags for RC. +# MAPFILE mapfile +# REORDER reorder file +# DEBUG_SYMBOLS add debug symbols (if configured on) +# CC the compiler to use, default is $(CC) +# LDEXE the linker to use for linking executables, default is $(LDEXE) +# OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST define SetupNativeCompilation - # param 1 is for example BUILD_MYPACKAGE - # param 2,3,4,5,6,7,8 are named args. - # SRC one or more directory roots to scan for C/C++ files. - # LANG C or C++ - # CFLAGS the compiler flags to be used, used both for C and C++. - # CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS. - # LDFLAGS the linker flags to be used, used both for C and C++. - # LDFLAGS_SUFFIX the linker flags to be added last on the commandline - # typically the libraries linked to. - # ARFLAGS the archiver flags to be used - # OBJECT_DIR the directory where we store the object files - # LIBRARY the resulting library file - # PROGRAM the resulting exec file - # INCLUDES only pick source from these directories - # EXCLUDES do not pick source from these directories - # INCLUDE_FILES only compile exactly these files! - # EXCLUDE_FILES with these names - # VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run - # RC_FLAGS flags for RC. - # MAPFILE mapfile - # REORDER reorder file - # DEBUG_SYMBOLS add debug symbols (if configured on) - # CC the compiler to use, default is $(CC) - # LDEXE the linker to use for linking executables, default is $(LDEXE) - # OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST + $(if $(27),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk)) + $(call EvalDebugWrapper,$(strip $1),$(call SetupNativeCompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15),$(16),$(17),$(18),$(19),$(20),$(21),$(22),$(23),$(24),$(25),$(26))) +endef + +define SetupNativeCompilationInner $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) $(call LogSetupMacroEntry,SetupNativeCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15),$(16),$(17),$(18),$(19),$(20),$(21),$(22),$(23),$(24),$(25),$(26)) $(if $(27),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk)) diff --git a/make/common/RMICompilation.gmk b/make/common/RMICompilation.gmk index 2c87b70441b..6f4706b1a5d 100644 --- a/make/common/RMICompilation.gmk +++ b/make/common/RMICompilation.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,17 +23,26 @@ # questions. # +# Setup make rules for creating an RMI compilation. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: +# CLASSES:=List of classes to generate stubs for +# CLASSES_DIR:=Directory where to look for classes +# STUB_CLASSES_DIR:=Directory in where to put stub classes +# RUN_V11:=Set to run rmic with -v1.1 +# RUN_V12:=Set to run rmic with -v1.2 +# RUN_IIOP:=Set to run rmic with -iiop +# RUN_IIOP_STDPKG:=Set to run rmic with -iiop -standardPackage +# KEEP_GENERATED:=Set to keep generated sources around define SetupRMICompilation - # param 1 is a name for a variable to depend on. - # param 2 and up are named args. - # CLASSES:=List of classes to generate stubs for - # CLASSES_DIR:=Directory where to look for classes - # STUB_CLASSES_DIR:=Directory in where to put stub classes - # RUN_V11:=Set to run rmic with -v1.1 - # RUN_V12:=Set to run rmic with -v1.2 - # RUN_IIOP:=Set to run rmic with -iiop - # RUN_IIOP_STDPKG:=Set to run rmic with -iiop -standardPackage - # KEEP_GENERATED:=Set to keep generated sources around + $(if $(16),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk)) + $(call EvalDebugWrapper,$(strip $1),$(call SetupRMICompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))) +endef + +define SetupRMICompilationInner $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) $(call LogSetupMacroEntry,SetupRMICompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) $(if $(16),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk)) diff --git a/make/common/TextFileProcessing.gmk b/make/common/TextFileProcessing.gmk index f5101626b0d..714fa55a54a 100644 --- a/make/common/TextFileProcessing.gmk +++ b/make/common/TextFileProcessing.gmk @@ -23,15 +23,9 @@ # questions. # -define EvalDebugWrapper - $(if $(DEBUG_$1), - $(info -------- <<< Begin expansion of $1) - $(info $2) - $(info -------- >>> End expansion of $1) - ) - - $2 -endef +ifeq (,$(_MAKEBASE_GMK)) + $(error You must include MakeBase.gmk prior to including TextFileProcessing.gmk) +endif # Helper function for SetupTextFileProcessing; adds a rule for a single file # to be processed. @@ -52,18 +46,20 @@ define SetupSingleTextFileForProcessing $1 += $(strip $3)/$(strip $4) endef -# Setup a text file for processing, in which specified markers are replaced with -# a given text, or with the contents of a given file. +# Setup make rules for processing one or more text files, in which specified +# markers are replaced with a given text, or with the contents of a given file. # -# param 1 is the name space for this setup, e.g. BUILD_VERSION_FILE -# param 2, 3, .. etc are named args: +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: # SOURCE_DIRS one or more directory roots to search for files to process # SOURCE_FILES complete paths to one or more files to process # OUTPUT_DIR the directory where we store the processed files. # OUTPUT_FILE the name of the resulting file. Only allowed if processing a # single file. # SOURCE_BASE_DIR a common root to all SOURCE_DIRS. -# If specified, files will keep the path relative to the base in the +# If specified, files will keep the path relative to the base in the # OUTPUT_DIR. Otherwise, the hierarchy will be flattened into the OUTPUT_DIR. # INCLUDE_FILES only include files matching these patterns (used only with # SOURCE_DIRS) diff --git a/make/common/ZipArchive.gmk b/make/common/ZipArchive.gmk new file mode 100644 index 00000000000..07d8bda1e38 --- /dev/null +++ b/make/common/ZipArchive.gmk @@ -0,0 +1,113 @@ +# +# 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. +# + +ifndef _ZIP_ARCHIVE_GMK +_ZIP_ARCHIVE_GMK := 1 + +ifeq (,$(_MAKEBASE_GMK)) + $(error You must include MakeBase.gmk prior to including ZipArchive.gmk) +endif + +# Setup make rules for creating a zip archive. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: +# SRC +# ZIP +# INCLUDES +# INCLUDE_FILES +# EXCLUDES +# EXCLUDE_FILES +# SUFFIXES +# EXTRA_DEPS +# ZIP_OPTIONS extra options to pass to zip +define SetupZipArchive + $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update ZipArchive.gmk)) + $(call EvalDebugWrapper,$(strip $1),$(call SetupZipArchiveInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))) +endef + +define SetupZipArchiveInner + $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE)) + $(call LogSetupMacroEntry,SetupZipArchive($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) + $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk)) + + # To avoid running find over too large sets of files, which causes make to crash + # on some configurations (cygwin), use INCLUDES and INCLUDE_FILES to build a set + # of directories to run find in, if available. + ifneq ($$($1_INCLUDES)$$($1_INCLUDE_FILES),) + $1_FIND_LIST := $$(wildcard $$(foreach i,$$($1_SRC), \ + $$(addprefix $$i/,$$($1_INCLUDES) $$($1_INCLUDE_FILES)))) + else + $1_FIND_LIST := $$($1_SRC) + endif + + # Find all files in the source tree. + $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST))) + + # Filter on suffixes if set + ifneq ($$($1_SUFFIXES),) + $1_ALL_SRCS := $$(filter $$(addprefix %, $$($1_SUFFIXES)), $$($1_ALL_SRCS)) + endif + + ifneq ($$($1_INCLUDES),) + ifneq ($$($1_SUFFIXES),) + $1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES), \ + $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES)))) + else + $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES))) + endif + endif + ifneq ($$($1_INCLUDE_FILES),) + $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_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($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)) + + # Now $1_ALL_SRCS should contain all sources that are going to be put into the zip. + # I.e. the zip -i and -x options should match the filtering done in the makefile. + # Explicitly excluded files can be given with absolute path. The patsubst solution + # isn't perfect but the likelyhood of an absolute path to match something in a src + # dir is very small. + # If zip has nothing to do, it returns 12 and would fail the build. Check for 12 + # and only fail if it's not. + $$($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_OPTIONS) $$@ . $$($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 + $1 += $$($1_ZIP) +endef + +endif # _ZIP_ARCHIVE_GMK From 88f336ba408a5d2462fc21285dbd77e0076a66dc Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 26 Nov 2014 15:14:14 +0100 Subject: [PATCH 094/138] 8065913: Various improvements in SetupNativeCompilation Reviewed-by: erikj --- common/autoconf/flags.m4 | 18 +-- common/autoconf/generated-configure.sh | 20 ++-- common/autoconf/spec.gmk.in | 1 + make/common/NativeCompilation.gmk | 154 ++++++++++++++++--------- 4 files changed, 121 insertions(+), 72 deletions(-) diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4 index cf73e40cedb..6ca045929ea 100644 --- a/common/autoconf/flags.m4 +++ b/common/autoconf/flags.m4 @@ -94,9 +94,9 @@ AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS], # On Windows, we need to set RC flags. if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then - RC_FLAGS="-nologo -l 0x409 -r" + RC_FLAGS="-nologo -l0x409" if test "x$VARIANT" = xOPT; then - RC_FLAGS="$RC_FLAGS -d NDEBUG" + RC_FLAGS="$RC_FLAGS -DNDEBUG" fi # The version variables used to create RC_FLAGS may be overridden @@ -105,13 +105,13 @@ AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS], # The \$ are escaped to the shell, and the $(...) variables # are evaluated by make. RC_FLAGS="$RC_FLAGS \ - -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \ - -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \ - -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \ - -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \ - -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \ - -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \ - -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\"" + -D\"JDK_BUILD_ID=\$(FULL_VERSION)\" \ + -D\"JDK_COMPANY=\$(COMPANY_NAME)\" \ + -D\"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \ + -D\"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \ + -D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \ + -D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \ + -D\"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\"" fi AC_SUBST(RC_FLAGS) diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 8b55a8f40fa..a773326eb06 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -4331,7 +4331,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=1416582658 +DATE_WHEN_GENERATED=1417011146 ############################################################################### # @@ -41641,9 +41641,9 @@ $as_echo "$tool_specified" >&6; } # On Windows, we need to set RC flags. if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then - RC_FLAGS="-nologo -l 0x409 -r" + RC_FLAGS="-nologo -l0x409" if test "x$VARIANT" = xOPT; then - RC_FLAGS="$RC_FLAGS -d NDEBUG" + RC_FLAGS="$RC_FLAGS -DNDEBUG" fi # The version variables used to create RC_FLAGS may be overridden @@ -41652,13 +41652,13 @@ $as_echo "$tool_specified" >&6; } # The \$ are escaped to the shell, and the $(...) variables # are evaluated by make. RC_FLAGS="$RC_FLAGS \ - -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \ - -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \ - -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \ - -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \ - -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \ - -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \ - -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\"" + -D\"JDK_BUILD_ID=\$(FULL_VERSION)\" \ + -D\"JDK_COMPANY=\$(COMPANY_NAME)\" \ + -D\"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \ + -D\"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \ + -D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \ + -D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \ + -D\"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\"" fi diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index bcf30a98a5a..ca4e1a82195 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -36,6 +36,7 @@ X:= SPACE:=$(X) $(X) COMMA:=, +DOLLAR:=$$ HASH:=\# LEFT_PAREN:=( RIGHT_PAREN:=) diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index 550b58e8064..ced60a15ff3 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -34,17 +34,18 @@ ifeq (,$(_MAKEBASE_GMK)) $(error You must include MakeBase.gmk prior to including NativeCompilation.gmk) endif -ifneq ($(TOOLCHAIN_TYPE), microsoft) - COMPILING_MSG=echo $(LOG_INFO) "Compiling $(notdir $1) (for $(notdir $2))" - LINKING_MSG=echo $(LOG_INFO) "Linking $1" - LINKING_EXE_MSG=echo $(LOG_INFO) "Linking executable $1" - ARCHIVING_MSG=echo $(LOG_INFO) "Archiving $1" -else - COMPILING_MSG= - LINKING_MSG= - LINKING_EXE_MSG= - ARCHIVING_MSG= -endif +# Extensions of files handled by this macro. +NATIVE_SOURCE_EXTENSIONS := %.s %.c %.cpp %.m %.mm + +# Replaces native source extensions with the object file extension in a string. +# Param 1: the string containing source file names with extensions +# The surrounding strip is needed to keep additional whitespace out +define replace_with_obj_extension +$(strip \ + $(foreach extension, $(NATIVE_SOURCE_EXTENSIONS), \ + $(patsubst $(extension),%$(OBJ_SUFFIX),$(filter $(extension),$1))) \ +) +endef ifeq ($(OPENJDK_BUILD_OS_ENV), windows.cygwin) UNIX_PATH_PREFIX := /cygdrive @@ -52,6 +53,15 @@ else ifeq ($(OPENJDK_BUILD_OS_ENV), windows.msys) UNIX_PATH_PREFIX := endif +WINDOWS_SHOWINCLUDE_SED_PATTERN := \ + -e '/^Note: including file:/!d' \ + -e 's|Note: including file: *||' \ + -e 's|\\|/|g' \ + -e 's|^\([a-zA-Z]\):|$(UNIX_PATH_PREFIX)/\1|g' \ + -e '/$(subst /,\/,$(TOPDIR))/!d' \ + -e 's|$$$$| \\|g' \ + # + define add_native_source # param 1 = BUILD_MYPACKAGE # parma 2 = the source file name (..../alfa.c or .../beta.cpp) @@ -60,7 +70,8 @@ define add_native_source # param 5 = the c compiler # param 6 = the c++ flags to the compiler # param 7 = the c++ compiler - # param 8 = the flags to the assembler + # param 8 = the objc compiler + # param 9 = the flags to the assembler ifneq (,$$(filter %.c,$2)) # Compile as a C file @@ -70,25 +81,27 @@ define add_native_source else ifneq (,$$(filter %.m,$2)) # Compile as a objective-c file $1_$2_FLAGS=-x objective-c $4 $$($1_$(notdir $2)_CFLAGS) -DTHIS_FILE='"$$( $$($1_$2_DEP).exitvalue) \ - | $(TEE) $$($1_$2_DEP).raw | $(GREP) -v "^Note: including file:" \ - && exit `cat $$($1_$2_DEP).exitvalue` + | $(TEE) $$($1_$2_DEP).raw | $(GREP) -v -e "^Note: including file:" \ + -e "^$(notdir $2)$$$$" ; exit `cat $$($1_$2_DEP).exitvalue` $(RM) $$($1_$2_DEP).exitvalue ($(ECHO) $$@: \\ \ - && $(SED) -e '/^Note: including file:/!d' \ - -e 's|Note: including file: *||' \ - -e 's|\\|/|g' \ - -e 's|^\([a-zA-Z]\):|$(UNIX_PATH_PREFIX)/\1|g' \ - -e '/$(subst /,\/,$(TOPDIR))/!d' \ - -e 's|$$$$| \\|g' \ - $$($1_$2_DEP).raw) > $$($1_$2_DEP) + && $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_$2_DEP).raw) > $$($1_$2_DEP) endif endif endef @@ -204,7 +211,11 @@ define SetupNativeCompilationInner $$(error LIBRARY should be specified without LIBRARY_PREFIX: $(LIBRARY_PREFIX)) endif - $1_BASENAME:=$(LIBRARY_PREFIX)$$($1_LIBRARY)$(SHARED_LIBRARY_SUFFIX) + ifeq ($$($1_SUFFIX), ) + $1_SUFFIX := $(SHARED_LIBRARY_SUFFIX) + endif + + $1_BASENAME:=$(LIBRARY_PREFIX)$$($1_LIBRARY)$$($1_SUFFIX) $1_TARGET:=$$($1_OUTPUT_DIR)/$$($1_BASENAME) $1_NOSUFFIX:=$(LIBRARY_PREFIX)$$($1_LIBRARY) endif @@ -226,7 +237,11 @@ define SetupNativeCompilationInner $$(error STATIC_LIBRARY should be specified without LIBRARY_PREFIX: $(LIBRARY_PREFIX)) endif - $1_BASENAME:=$(LIBRARY_PREFIX)$$($1_STATIC_LIBRARY)$(STATIC_LIBRARY_SUFFIX) + ifeq ($$($1_SUFFIX), ) + $1_SUFFIX := $(STATIC_LIBRARY_SUFFIX) + endif + + $1_BASENAME:=$(LIBRARY_PREFIX)$$($1_STATIC_LIBRARY)$$($1_SUFFIX) $1_TARGET:=$$($1_OUTPUT_DIR)/$$($1_BASENAME) $1_NOSUFFIX:=$(LIBRARY_PREFIX)$$($1_STATIC_LIBRARY) endif @@ -244,7 +259,11 @@ define SetupNativeCompilationInner $$(error PROGRAM should be specified without EXE_SUFFIX: $(EXE_SUFFIX)) endif - $1_BASENAME:=$$($1_PROGRAM)$(EXE_SUFFIX) + ifeq ($$($1_SUFFIX), ) + $1_SUFFIX := $(EXE_SUFFIX) + endif + + $1_BASENAME:=$$($1_PROGRAM)$$($1_SUFFIX) $1_TARGET:=$$($1_OUTPUT_DIR)/$$($1_BASENAME) $1_NOSUFFIX:=$$($1_PROGRAM) endif @@ -260,11 +279,17 @@ define SetupNativeCompilationInner ifeq ($$($1_LDEXE),) $1_LDEXE:=$(LDEXE) endif - $1_LD:=$(LD) + ifeq ($$($1_LD),) + $1_LD:=$(LD) + endif else ifeq (C++,$$($1_LANG)) - $1_LD:=$(LDCXX) - $1_LDEXE:=$(LDEXECXX) + ifeq ($$($1_LD),) + $1_LD:=$(LDCXX) + endif + ifeq ($$($1_LDEXE),) + $1_LDEXE:=$(LDEXECXX) + endif else $$(error Unknown native language $$($1_LANG) for $1) endif @@ -273,6 +298,12 @@ define SetupNativeCompilationInner ifeq ($$($1_CC),) $1_CC:=$(CC) endif + ifeq ($$($1_CXX),) + $1_CXX:=$(CXX) + endif + ifeq ($$($1_OBJC),) + $1_OBJC:=$(OBJC) + endif # Make sure the dirs exist. $$(eval $$(call MakeDir,$$($1_OBJECT_DIR) $$($1_OUTPUT_DIR))) @@ -286,7 +317,7 @@ define SetupNativeCompilationInner ifneq ($$($1_EXCLUDE_FILES),) $1_EXCLUDE_FILES:=$$(addprefix %,$$($1_EXCLUDE_FILES)) endif - $1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES),$$(filter %.s %.c %.cpp %.m,$$($1_ALL_SRCS))) + $1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES),$$(filter $$(NATIVE_SOURCE_EXTENSIONS),$$($1_ALL_SRCS))) ifneq (,$$(strip $$($1_INCLUDE_FILES))) $1_SRCS := $$(filter $$($1_INCLUDE_FILES),$$($1_SRCS)) endif @@ -309,9 +340,12 @@ define SetupNativeCompilationInner $1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS)) endif + $1_SRCS += $$($1_EXTRA_FILES) + # Calculate the expected output from compiling the sources (sort to remove duplicates. Also provides # a reproducable order on the input files to the linker). - $1_EXPECTED_OBJS:=$$(sort $$(addprefix $$($1_OBJECT_DIR)/,$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(patsubst %.m,%$(OBJ_SUFFIX),$$(patsubst %.s,%$(OBJ_SUFFIX),$$(notdir $$($1_SRCS)))))))) + $1_EXPECTED_OBJS_FILENAMES := $$(call replace_with_obj_extension, $$(notdir $$($1_SRCS))) + $1_EXPECTED_OBJS:=$$(sort $$(addprefix $$($1_OBJECT_DIR)/,$$($1_EXPECTED_OBJS_FILENAMES))) # Are there too many object files on disk? Perhaps because some source file was removed? $1_SUPERFLOUS_OBJS:=$$(sort $$(filter-out $$($1_EXPECTED_OBJS),$$($1_BINS))) # Clean out the superfluous object files. @@ -345,7 +379,7 @@ define SetupNativeCompilationInner $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)_release) endif - ifneq (,$$($1_DEBUG_SYMBOLS)) + ifeq ($$($1_DEBUG_SYMBOLS), true) ifeq ($(ENABLE_DEBUG_SYMBOLS), true) ifdef OPENJDK # Always add debug symbols @@ -390,22 +424,38 @@ define SetupNativeCompilationInner $$(error Unknown value for OPTIMIZATION: $$($1_OPTIMIZATION)) endif - # Add sys root specific cflags last - $1_EXTRA_CFLAGS += $(SYSROOT_CFLAGS) - $1_EXTRA_CXXFLAGS += $(SYSROOT_CFLAGS) + $1_BUILD_INFO := $$($1_OBJECT_DIR)/_build-info.marker + + # Setup rule for printing progress info when compiling source files. + # This is a rough heuristic and may not always print accurate information. + $$($1_BUILD_INFO): $$($1_SRCS) + ifeq ($$(wildcard $$($1_TARGET)),) + $(ECHO) 'Creating $$($1_BASENAME) from $$(words $$?) file(s)' + else + $(ECHO) 'Updating $$($1_BASENAME) from $$(words $$?) file(s)' + endif + $(TOUCH) $$@ # Now call add_native_source for each source file we are going to compile. $$(foreach p,$$($1_SRCS), \ $$(eval $$(call add_native_source,$1,$$p,$$($1_OBJECT_DIR), \ - $$($1_CFLAGS) $$($1_EXTRA_CFLAGS),$$($1_CC), \ - $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS),$(CXX),$$($1_ASFLAGS)))) + $(SYSROOT_CFLAGS) $$($1_CFLAGS) $$($1_EXTRA_CFLAGS),$$($1_CC), \ + $(SYSROOT_CFLAGS) $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS),$$($1_CXX),$$($1_OBJC),$$($1_ASFLAGS)))) # On windows we need to create a resource file ifeq ($(OPENJDK_TARGET_OS), windows) ifneq (,$$($1_VERSIONINFO_RESOURCE)) $1_RES:=$$($1_OBJECT_DIR)/$$($1_BASENAME).res + $1_RES_DEP:=$$($1_RES).d + -include $$($1_RES_DEP) $$($1_RES): $$($1_VERSIONINFO_RESOURCE) + $(ECHO) $(LOG_INFO) "Compiling resource $$(notdir $$($1_VERSIONINFO_RESOURCE)) (for $$(notdir $$($1_TARGET)))" $(RC) $$($1_RC_FLAGS) $(CC_OUT_OPTION)$$@ $$($1_VERSIONINFO_RESOURCE) + # Windows RC compiler does not support -showIncludes, so we mis-use CL for this. + $(CC) $$($1_RC_FLAGS) -showIncludes -nologo -TC \ + $(CC_OUT_OPTION)$$($1_RES_DEP).obj $$($1_VERSIONINFO_RESOURCE) > $$($1_RES_DEP).raw 2>&1 || exit 0 + ($(ECHO) $$($1_RES): \\ \ + && $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).raw) > $$($1_RES_DEP) endif ifneq (,$$($1_MANIFEST)) $1_GEN_MANIFEST:=$$($1_OBJECT_DIR)/$$($1_PROGRAM).manifest @@ -439,12 +489,10 @@ define SetupNativeCompilationInner $1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE)) endif - $1_EXTRA_LDFLAGS += $(SYSROOT_LDFLAGS) - # Need to make sure TARGET is first on list $1 := $$($1_TARGET) ifeq ($$($1_STATIC_LIBRARY),) - ifneq ($$($1_DEBUG_SYMBOLS),) + ifeq ($$($1_DEBUG_SYMBOLS), true) ifeq ($(ENABLE_DEBUG_SYMBOLS), true) ifneq ($(OPENJDK_TARGET_OS), macosx) # no MacOS X support yet ifneq ($$($1_OUTPUT_DIR),$$($1_OBJECT_DIR)) @@ -523,10 +571,10 @@ define SetupNativeCompilationInner $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) + $(ECHO) $(LOG_INFO) "Linking $$($1_BASENAME)" + $$($1_LD) $(SYSROOT_LDFLAGS) $$($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) @@ -538,7 +586,7 @@ define SetupNativeCompilationInner ifneq (,$$($1_STATIC_LIBRARY)) # Generating a static library, ie object file archive. $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) - $$(call ARCHIVING_MSG,$$($1_LIBRARY)) + $(ECHO) $(LOG_INFO) "Archiving $$($1_STATIC_LIBRARY)" $(AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_EXPECTED_OBJS) \ $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) endif @@ -548,8 +596,8 @@ define SetupNativeCompilationInner $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) \ + $(ECHO) $(LOG_INFO) "Linking executable $$($1_BASENAME)" + $$($1_LDEXE) $(SYSROOT_LDFLAGS) $$($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)) From 2f10adad63dc9cded883f68e7a242992fd3b566e Mon Sep 17 00:00:00 2001 From: Erik Helin Date: Mon, 24 Nov 2014 14:44:10 +0100 Subject: [PATCH 095/138] 8065648: Remove the flag -fsanitize=undefined for GCC 4.9 and later Reviewed-by: erikj --- common/autoconf/flags.m4 | 23 ------- common/autoconf/generated-configure.sh | 94 +------------------------- common/autoconf/toolchain.m4 | 6 -- 3 files changed, 1 insertion(+), 122 deletions(-) diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4 index 6ca045929ea..90f369a12a8 100644 --- a/common/autoconf/flags.m4 +++ b/common/autoconf/flags.m4 @@ -348,10 +348,6 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION], # Add runtime stack smashing and undefined behavior checks CFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1" CXXFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1" - if test "x$HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" = "xtrue"; then - CFLAGS_DEBUG_OPTIONS="$CFLAGS_DEBUG_OPTIONS $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG" - CXXFLAGS_DEBUG_OPTIONS="$CXXFLAGS_DEBUG_OPTIONS $CFLAG_DETECT_UNDEFINED_BEHAVIsOR_FLAG" - fi ;; esac fi @@ -746,25 +742,6 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib" fi - if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then - # If undefined behaviour detection is enabled then we need to tell linker. - case $DEBUG_LEVEL in - release | fastdebug ) - ;; - slowdebug ) - AC_MSG_WARN([$HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR]) - if test "x$HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" = "xtrue"; then - # enable undefined behaviour checking - LDFLAGS_JDK="$LDFLAGS_JDK `$ECHO -n $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG | sed -e "s/[ ]*\([^ ]\+\)/ -Xlinker \1/g"`" - LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK `$ECHO -n $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG | sed -e "s/[ ]*\([^ ]\+\)/ -Xlinker \1/g"`" - fi - ;; - * ) - AC_MSG_ERROR([Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL]) - ;; - esac - fi - # Customize LDFLAGS for executables LDFLAGS_JDKEXE="${LDFLAGS_JDK}" diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index a773326eb06..94b701bea19 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -4331,7 +4331,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=1417011146 +DATE_WHEN_GENERATED=1417016445 ############################################################################### # @@ -41017,74 +41017,6 @@ $as_echo "$supports" >&6; } fi - # "-fsanitize=undefined" supported for GCC 4.9 and later - CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG="-fsanitize=undefined -fsanitize-recover" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"$CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG\"" >&5 -$as_echo_n "checking if compiler supports \"$CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG\"... " >&6; } - supports=yes - - saved_cflags="$CFLAGS" - CFLAGS="$CFLAGS $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG" - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int i; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - supports=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - CFLAGS="$saved_cflags" - - saved_cxxflags="$CXXFLAGS" - CXXFLAGS="$CXXFLAG $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG" - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int i; -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - -else - supports=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - CXXFLAGS="$saved_cxxflags" - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5 -$as_echo "$supports" >&6; } - if test "x$supports" = "xyes" ; then - HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR=true - else - HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR=false - fi - - # "-z relro" supported in GNU binutils 2.17 and later LINKER_RELRO_FLAG="-Xlinker -z -Xlinker relro" @@ -42428,10 +42360,6 @@ $as_echo "$ac_cv_c_bigendian" >&6; } # Add runtime stack smashing and undefined behavior checks CFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1" CXXFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1" - if test "x$HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" = "xtrue"; then - CFLAGS_DEBUG_OPTIONS="$CFLAGS_DEBUG_OPTIONS $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG" - CXXFLAGS_DEBUG_OPTIONS="$CXXFLAGS_DEBUG_OPTIONS $CFLAG_DETECT_UNDEFINED_BEHAVIsOR_FLAG" - fi ;; esac fi @@ -42839,26 +42767,6 @@ fi LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib" fi - if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then - # If undefined behaviour detection is enabled then we need to tell linker. - case $DEBUG_LEVEL in - release | fastdebug ) - ;; - slowdebug ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" >&5 -$as_echo "$as_me: WARNING: $HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" >&2;} - if test "x$HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" = "xtrue"; then - # enable undefined behaviour checking - LDFLAGS_JDK="$LDFLAGS_JDK `$ECHO -n $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG | sed -e "s/ *\(^ \+\)/ -Xlinker \1/g"`" - LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK `$ECHO -n $CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG | sed -e "s/ *\(^ \+\)/ -Xlinker \1/g"`" - fi - ;; - * ) - as_fn_error $? "Unrecognized \$DEBUG_LEVEL: $DEBUG_LEVEL" "$LINENO" 5 - ;; - esac - fi - # Customize LDFLAGS for executables LDFLAGS_JDKEXE="${LDFLAGS_JDK}" diff --git a/common/autoconf/toolchain.m4 b/common/autoconf/toolchain.m4 index db0a253a207..9b16574848f 100644 --- a/common/autoconf/toolchain.m4 +++ b/common/autoconf/toolchain.m4 @@ -712,12 +712,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS], [HAS_CFLAG_OPTIMIZE_DEBUG=true], [HAS_CFLAG_OPTIMIZE_DEBUG=false]) - # "-fsanitize=undefined" supported for GCC 4.9 and later - CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG="-fsanitize=undefined -fsanitize-recover" - FLAGS_COMPILER_CHECK_ARGUMENTS([$CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG], - [HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR=true], - [HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR=false]) - # "-z relro" supported in GNU binutils 2.17 and later LINKER_RELRO_FLAG="-Xlinker -z -Xlinker relro" FLAGS_LINKER_CHECK_ARGUMENTS([$LINKER_RELRO_FLAG], From 26298f1124f15e809857122b84821b672f05e79e Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Mon, 24 Nov 2014 16:02:35 +0100 Subject: [PATCH 096/138] 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 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 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 634c33938c27e2da6300b0eaf4fd0660111baa48 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Mon, 24 Nov 2014 14:52:46 -0800 Subject: [PATCH 097/138] 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 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 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 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 samPTypes = samDesc.getParameterTypes(); + List 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 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. ) 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 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 list = main.toInfoListError(Arrays.asList(new Base_MRI1())); + System.out.printf("result %d\n", list.size()); + } + + public List toInfoListError(List list) { + Comparator byNameComparator = + (B_MRI1 b1, B_MRI1 b2) -> b1.getB().compareToIgnoreCase(b2.getB()); + return list.stream().sorted(byNameComparator).map(Info_MRI1::new).collect(toList()); + } + + public List toInfoListWorks(List list) { + Comparator 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; + + 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 { + Info(H h) { } + + static 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 void test() { + Function f1L = _h -> new Info(_h); + Function f1 = Info::new; + Function f2L = _h -> Info.info(_h); + Function 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 { + void foo(T t); + } + + static void bar(T t) { + } + + public static void main(String[] args) { + Foo foo = MethodReferenceIntersection3::bar; + foo.foo(new A(){}); + } +} From 137d39454df62bf1b4a3dd7cbd4b21fa1fa7c5e1 Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Wed, 26 Nov 2014 08:06:58 +0100 Subject: [PATCH 098/138] 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(""); close(partial_fd); - unlink(partial_file); } CompileLog* next_log = log->_next; - delete log; + delete log; // Removes partial file log = next_log; } _first = NULL; From e79371a0bc7fbea54a041a13e99af0d9f3c815c6 Mon Sep 17 00:00:00 2001 From: Attila Szegedi Date: Thu, 27 Nov 2014 13:04:46 +0100 Subject: [PATCH 099/138] 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 { * @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 Date: Thu, 27 Nov 2014 17:14:01 +0400 Subject: [PATCH 100/138] 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 c4ced97793697766d7c7b8eb254211a92bd523ea Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Thu, 27 Nov 2014 15:41:56 +0100 Subject: [PATCH 101/138] 8065914: Various improvements and cleanup of build system Reviewed-by: erikj --- Makefile | 15 +- common/autoconf/basics.m4 | 4 +- common/autoconf/boot-jdk.m4 | 30 +- common/autoconf/bootcycle-spec.gmk.in | 1 - common/autoconf/build-aux/config.guess | 2 +- common/autoconf/build-aux/install.sh | 10 +- common/autoconf/compare.sh.in | 1 + common/autoconf/generated-configure.sh | 2 +- common/autoconf/libraries.m4 | 2 +- common/autoconf/spec.gmk.in | 4 +- common/autoconf/toolchain_windows.m4 | 14 +- common/bin/compare.sh | 492 +++++++++++-------------- common/bin/compare_exceptions.sh.incl | 99 +++-- common/bin/logger.sh | 4 +- common/bin/shell-tracer.sh | 6 +- common/bin/test_builds.sh | 3 +- common/bin/unshuffle_patch.sh | 3 +- make/CompileJavaModules.gmk | 6 +- make/Javadoc.gmk | 2 +- make/Main.gmk | 22 +- make/MakeHelpers.gmk | 25 +- make/common/JavaCompilation.gmk | 8 +- make/common/MakeBase.gmk | 6 +- make/common/RMICompilation.gmk | 8 +- make/common/SetupJavaCompilers.gmk | 6 +- make/common/TextFileProcessing.gmk | 40 +- make/jprt.properties | 2 +- make/scripts/normalizer.pl | 28 +- make/scripts/update_copyright_year.sh | 1 - 29 files changed, 422 insertions(+), 424 deletions(-) diff --git a/Makefile b/Makefile index d4b36e4539d..d89adc033d4 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ default: # The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make. # /usr/ccs/bin/make lacks basically every other flow control mechanism. -TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1 +.TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1 # Assume we have GNU make, but check version. ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), ) @@ -46,7 +46,17 @@ ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),) else makefile_path:=$(lastword $(MAKEFILE_LIST)) endif -root_dir:=$(dir $(makefile_path)) +root_dir:=$(patsubst %/,%,$(dir $(makefile_path))) + +ifneq ($(findstring qp,$(MAKEFLAGS)),) + # When called with -qp, assume an external part (e.g. bash completion) is trying + # to understand our targets. + # Duplication of global targets, needed before ParseConfAndSpec in case we have + # no configurations. + help: + # If CONF is not set, look for all available configurations + CONF?= +endif # ... and then we can include our helper functions include $(root_dir)/make/MakeHelpers.gmk @@ -89,6 +99,7 @@ else # The wrapper target was called so we now have a single configuration. Load the spec file # and call the real Main.gmk. include $(SPEC) + include $(SRC_ROOT)/make/common/MakeBase.gmk ### Clean up from previous run # Remove any build.log from a previous run, if they exist diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4 index a7cf6c816a7..62d83574289 100644 --- a/common/autoconf/basics.m4 +++ b/common/autoconf/basics.m4 @@ -268,7 +268,7 @@ AC_DEFUN([BASIC_CHECK_LEFTOVER_OVERRIDDEN], fi ]) -# Setup a tool for the given variable. If correctly specified by the user, +# Setup a tool for the given variable. If correctly specified by the user, # use that value, otherwise search for the tool using the supplied code snippet. # $1: variable to set # $2: code snippet to call to look for the tool @@ -546,7 +546,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT], XCODEBUILD= AC_SUBST(XCODEBUILD) fi - + AC_MSG_CHECKING([for sdk name]) AC_ARG_WITH([sdk-name], [AS_HELP_STRING([--with-sdk-name], [use the platform SDK of the given name. @<:@macosx@:>@])], diff --git a/common/autoconf/boot-jdk.m4 b/common/autoconf/boot-jdk.m4 index fbfa15c7b06..6509d0bee2c 100644 --- a/common/autoconf/boot-jdk.m4 +++ b/common/autoconf/boot-jdk.m4 @@ -24,31 +24,31 @@ # ######################################################################## -# This file handles detection of the Boot JDK. The Boot JDK detection -# process has been developed as a response to solve a complex real-world -# problem. Initially, it was simple, but it has grown as platform after +# This file handles detection of the Boot JDK. The Boot JDK detection +# process has been developed as a response to solve a complex real-world +# problem. Initially, it was simple, but it has grown as platform after # platform, idiosyncracy after idiosyncracy has been supported. # # The basic idea is this: # 1) You need an acceptable *) JDK to use as a Boot JDK -# 2) There are several ways to locate a JDK, that are mostly platform +# 2) There are several ways to locate a JDK, that are mostly platform # dependent **) # 3) You can have multiple JDKs installed -# 4) If possible, configure should try to dig out an acceptable JDK +# 4) If possible, configure should try to dig out an acceptable JDK # automatically, without having to resort to command-line options # -# *) acceptable means e.g. JDK7 for building JDK8, a complete JDK (with -# javac) and not a JRE, etc. +# *) acceptable means e.g. JDK7 for building JDK8, a complete JDK (with +# javac) and not a JRE, etc. # -# **) On Windows we typically use a well-known path. +# **) On Windows we typically use a well-known path. # On MacOSX we typically use the tool java_home. -# On Linux we typically find javac in the $PATH, and then follow a -# chain of symlinks that often ends up in a real JDK. +# On Linux we typically find javac in the $PATH, and then follow a +# chain of symlinks that often ends up in a real JDK. # -# This leads to the code where we check in different ways to locate a -# JDK, and if one is found, check if it is acceptable. If not, we print -# our reasons for rejecting it (useful when debugging non-working -# configure situations) and continue checking the next one. +# This leads to the code where we check in different ways to locate a +# JDK, and if one is found, check if it is acceptable. If not, we print +# our reasons for rejecting it (useful when debugging non-working +# configure situations) and continue checking the next one. ######################################################################## # Execute the check given as argument, and verify the result @@ -244,7 +244,7 @@ AC_DEFUN([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS], AC_DEFUN([BOOTJDK_CHECK_TOOL_IN_BOOTJDK], [ # Use user overridden value if available, otherwise locate tool in the Boot JDK. - BASIC_SETUP_TOOL($1, + BASIC_SETUP_TOOL($1, [ AC_MSG_CHECKING([for $2 in Boot JDK]) $1=$BOOT_JDK/bin/$2 diff --git a/common/autoconf/bootcycle-spec.gmk.in b/common/autoconf/bootcycle-spec.gmk.in index 87e6203fc88..ba32e409ec2 100644 --- a/common/autoconf/bootcycle-spec.gmk.in +++ b/common/autoconf/bootcycle-spec.gmk.in @@ -57,4 +57,3 @@ JAR_CMD:=$(BOOT_JDK)/bin/jar NATIVE2ASCII_CMD:=$(BOOT_JDK)/bin/native2ascii JARSIGNER_CMD:=$(BOOT_JDK)/bin/jarsigner SJAVAC_SERVER_JAVA_CMD:=$(JAVA_CMD) - diff --git a/common/autoconf/build-aux/config.guess b/common/autoconf/build-aux/config.guess index 355c91e4ebb..a450a2760f6 100644 --- a/common/autoconf/build-aux/config.guess +++ b/common/autoconf/build-aux/config.guess @@ -77,7 +77,7 @@ if test $? = 0; then fi # Test and fix little endian PowerPC64. -# TODO: should be handled by autoconf-config.guess. +# TODO: should be handled by autoconf-config.guess. if [ "x$OUT" = x ]; then if [ `uname -m` = ppc64le ]; then if [ `uname -s` = Linux ]; then diff --git a/common/autoconf/build-aux/install.sh b/common/autoconf/build-aux/install.sh index 02d43282e42..98c1dc444a7 100644 --- a/common/autoconf/build-aux/install.sh +++ b/common/autoconf/build-aux/install.sh @@ -1,5 +1,5 @@ -#!/bin/sh -echo >&2 "No suitable 'install' command found.'" -echo >&2 "If automake is installed, running 'automake -fa'" -echo >&2 "(and ignoring the errors) might produce one." -exit 1 +#!/bin/sh +echo >&2 "No suitable 'install' command found.'" +echo >&2 "If automake is installed, running 'automake -fa'" +echo >&2 "(and ignoring the errors) might produce one." +exit 1 diff --git a/common/autoconf/compare.sh.in b/common/autoconf/compare.sh.in index 4c6207176c5..c96c87aee95 100644 --- a/common/autoconf/compare.sh.in +++ b/common/autoconf/compare.sh.in @@ -47,6 +47,7 @@ FIND="@FIND@" GREP="@GREP@" JAVAP="@FIXPATH@ @BOOT_JDK@/bin/javap @JAVA_TOOL_FLAGS_SMALL@" LDD="@LDD@" +LN="@LN@" MKDIR="@MKDIR@" NAWK="@NAWK@" NM="@GNM@" diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 94b701bea19..d950cb1558b 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -4331,7 +4331,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=1417016445 +DATE_WHEN_GENERATED=1417099232 ############################################################################### # diff --git a/common/autoconf/libraries.m4 b/common/autoconf/libraries.m4 index 41cb2fb49d6..8d4e73488bc 100644 --- a/common/autoconf/libraries.m4 +++ b/common/autoconf/libraries.m4 @@ -355,7 +355,7 @@ AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE], FOUND_FREETYPE=no fi fi - + if test "x$FOUND_FREETYPE" = xyes; then # Include file found, let's continue the sanity check. AC_MSG_NOTICE([Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD]) diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index ca4e1a82195..999a9b32310 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -456,7 +456,7 @@ JAVA_FLAGS_SMALL:=@JAVA_FLAGS_SMALL@ JAVA_TOOL_FLAGS_SMALL:=@JAVA_TOOL_FLAGS_SMALL@ SJAVAC_SERVER_JAVA_FLAGS:=@SJAVAC_SERVER_JAVA_FLAGS@ -# The *_CMD variables are defined separately to be easily overridden in bootcycle-spec.gmk +# The *_CMD variables are defined separately to be easily overridden in bootcycle-spec.gmk # for bootcycle-images build. Make sure to keep them in sync. Do not use the *_CMD # versions of the variables directly. JAVA_CMD:=@JAVA@ @@ -713,7 +713,7 @@ JRE_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_BUNDLE_SUBDIR) # This macro is called to allow inclusion of closed source counterparts. # Unless overridden in closed sources, it expands to nothing. -# Usage: This function is called in an open makefile, with the following +# Usage: This function is called in an open makefile, with the following # arguments: # $1 the name of the repo, or empty if the top-level repo. # $2 the name of the makefile diff --git a/common/autoconf/toolchain_windows.m4 b/common/autoconf/toolchain_windows.m4 index 380f7dd4054..231d2e837f2 100644 --- a/common/autoconf/toolchain_windows.m4 +++ b/common/autoconf/toolchain_windows.m4 @@ -248,7 +248,7 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL], METHOD="$2" if test -e "$POSSIBLE_MSVCR_DLL"; then AC_MSG_NOTICE([Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD]) - + # Need to check if the found msvcr is correct architecture AC_MSG_CHECKING([found msvcr100.dll architecture]) MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"` @@ -291,7 +291,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL], AC_MSG_ERROR([Could not find a proper msvcr100.dll as specified by --with-msvcr-dll]) fi fi - + if test "x$MSVCR_DLL" = x; then # Probe: Using well-known location from Visual Studio 10.0 if test "x$VCINSTALLDIR" != x; then @@ -311,9 +311,9 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL], POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll" TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in Boot JDK]) fi - + if test "x$MSVCR_DLL" = x; then - # Probe: Look in the Windows system32 directory + # Probe: Look in the Windows system32 directory CYGWIN_SYSTEMROOT="$SYSTEMROOT" BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT) POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll" @@ -333,7 +333,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL], TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VS100COMNTOOLS]) fi fi - + if test "x$MSVCR_DLL" = x; then # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now. # (This was the original behaviour; kept since it might turn up something) @@ -347,11 +347,11 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL], POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1` fi fi - + TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VCINSTALLDIR]) fi fi - + if test "x$MSVCR_DLL" = x; then AC_MSG_CHECKING([for msvcr100.dll]) AC_MSG_RESULT([no]) diff --git a/common/bin/compare.sh b/common/bin/compare.sh index 31ec560dd16..8bd6d124cc7 100644 --- a/common/bin/compare.sh +++ b/common/bin/compare.sh @@ -22,7 +22,7 @@ # questions. # -# This script is processed by configure before it's usable. It is run from +# This script is processed by configure before it's usable. It is run from # the root of the build directory. @@ -76,10 +76,13 @@ diff_text() { TMP=1 if [[ "$THIS_FILE" = *"META-INF/MANIFEST.MF" ]]; then + # Filter out date string, ant version and java version differences. TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \ $GREP '^[<>]' | \ $SED -e '/[<>] Ant-Version: Apache Ant .*/d' \ - -e '/[<>] Created-By: .* (Oracle Corporation).*/d') + -e '/[<>] Created-By: .* (Oracle [Corpatin)]*/d' \ + -e '/[<>] [Corpatin]*)/d' \ + -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d') fi if test "x$SUFFIX" = "xjava"; then TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \ @@ -92,7 +95,7 @@ diff_text() { -e '/\/\/ java GenerateCharacter.*/d') fi # Ignore date strings in class files. - # On Macosx the system sources for generated java classes produce different output on + # On Macosx the system sources for generated java classes produce different output on # consequtive invocations seemingly randomly. # For example a method parameter randomly named "thePoint" or "aPoint". Ignore this. # Anonymous lambda classes get randomly assigned counters in their names. @@ -100,18 +103,18 @@ diff_text() { # To improve performance when large diffs are found, do a rough filtering of classes # elibeble for these exceptions if $GREP -R -e '[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}' \ - -e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \ - -e thePoint -e aPoint -e setItemsPtr \ + -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 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' \ - -e '/[0-9]\{2\}\/[0-9]\{2\}\/[0-9]\{4\}/d' \ - -e '/[<>].*Point Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \ - -e '/[<>].*public com\.apple\.jobjc\.Pointer].*public void setItemsPtr(com\.apple\.jobjc\.Pointer].*Point Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \ + -e '/[<>].*public com\.apple\.jobjc\.Pointer].*public void setItemsPtr(com\.apple\.jobjc\.Pointer].*lambda\$[a-zA-Z0-9]*\$[0-9]*/d') fi fi @@ -121,20 +124,19 @@ diff_text() { # Disable this exception since we aren't changing the properties cleaning method yet. # $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \ # | $SED -f "$SRC_ROOT/common/makefiles/support/unicode2x.sed" \ -# | $SED -e '/^#/d' -e '/^$/d' \ +# | $SED -e '/^#/d' -e '/^$/d' \ # -e :a -e '/\\$/N; s/\\\n//; ta' \ -# -e 's/^[ \t]*//;s/[ \t]*$//' \ -# -e 's/\\=/=/' | LC_ALL=C $SORT > $OTHER_FILE.cleaned +# -e 's/^[ \t]*//;s/[ \t]*$//' \ +# -e 's/\\=/=/' | LC_ALL=C $SORT > $OTHER_FILE.cleaned # Filter out date string differences. TMP=$(LC_ALL=C $DIFF $OTHER_FILE.cleaned $THIS_FILE | \ $GREP '^[<>]' | \ $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d') fi - if test "x$SUFFIX" = "xMF"; then - # Filter out date string differences. + if test "x$SUFFIX" = "xhtml"; then TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \ $GREP '^[<>]' | \ - $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d') + $SED -e '/[<>] /d' ) fi if test -n "$TMP"; then echo Files $OTHER_FILE and $THIS_FILE differ @@ -158,7 +160,7 @@ compare_dirs() { (cd $THIS_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_this) $DIFF $WORK_DIR/dirs_other $WORK_DIR/dirs_this > $WORK_DIR/dirs_diff - + echo -n Directory structure... if [ -s $WORK_DIR/dirs_diff ]; then echo Differences found. @@ -192,7 +194,7 @@ compare_files() { (cd $OTHER_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_other) (cd $THIS_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_this) - + $DIFF $WORK_DIR/files_other $WORK_DIR/files_this > $WORK_DIR/files_diff echo -n File names... @@ -236,11 +238,11 @@ compare_permissions() { TP=`ls -l ${THIS_DIR}/$f | awk '{printf("%.10s\n", $1);}'` if [ "$OP" != "$TP" ] then - if [ -z "$found" ]; then echo ; found="yes"; fi - $PRINTF "\told: ${OP} new: ${TP}\t$f\n" + if [ -z "$found" ]; then echo ; found="yes"; fi + $PRINTF "\tother: ${OP} this: ${TP}\t$f\n" fi done - if [ -z "$found" ]; then + if [ -z "$found" ]; then echo "Identical!" else REGRESSIONS=true @@ -265,24 +267,22 @@ compare_file_types() { if [ ! -f ${THIS_DIR}/$f ]; then continue; fi OF=`cd ${OTHER_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'` TF=`cd ${THIS_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'` - if [ "$f" = "./src.zip" ] || [[ "$f" = *"/Home/src.zip" ]] || [[ "$f" = *"/lib/JObjC.jar" ]] - then - if [ "`echo $OF | $GREP -ic zip`" -gt 0 -a "`echo $TF | $GREP -ic zip`" -gt 0 ] - then - # the way we produces zip-files make it so that directories are stored in old file - # but not in new (only files with full-path) - # this makes file-5.09 report them as different - continue; - fi - fi - if [ "$OF" != "$TF" ] then - if [ -z "$found" ]; then echo ; found="yes"; fi - $PRINTF "\tother: ${OF}\n\tthis : ${TF}\n" + if [ "`echo $OF | $GREP -c 'Zip archive data'`" -gt 0 ] \ + && [ "`echo $TF | $GREP -c 'Zip archive data'`" -gt 0 ] + then + # the way we produce zip-files make it so that directories are stored in + # old file but not in new (only files with full-path) this makes file + # report them as different + continue + else + if [ -z "$found" ]; then echo ; found="yes"; fi + $PRINTF "\tother: ${OF}\n\tthis : ${TF}\n" + fi fi done - if [ -z "$found" ]; then + if [ -z "$found" ]; then echo "Identical!" else REGRESSIONS=true @@ -296,12 +296,13 @@ compare_general_files() { THIS_DIR=$1 OTHER_DIR=$2 WORK_DIR=$3 - + GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \ ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \ - ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \ + ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" ! -name "*.cpl" \ ! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \ - ! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" \ + ! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" ! -name "*.jmod" \ + ! -name "*.obj" ! -name "*.o" ! -name "JavaControlPanelHelper" ! -name "JavaUpdater" \ | $GREP -v "./bin/" | $SORT | $FILTER) echo General files... @@ -377,7 +378,7 @@ compare_zip_file() { THIS_SUFFIX="${THIS_ZIP##*.}" OTHER_SUFFIX="${OTHER_ZIP##*.}" if [ "$THIS_SUFFIX" != "$OTHER_SUFFIX" ]; then - echo The files do not have the same suffix type! + echo "The files do not have the same suffix type! ($THIS_SUFFIX != $OTHER_SUFFIX)" return 2 fi @@ -389,7 +390,7 @@ compare_zip_file() { fi # Not quite identical, the might still contain the same data. # Unpack the jar/zip files in temp dirs - + THIS_UNZIPDIR=$WORK_DIR/$ZIP_FILE.this OTHER_UNZIPDIR=$WORK_DIR/$ZIP_FILE.other $RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR @@ -458,9 +459,9 @@ compare_zip_file() { $RM -f $WORK_DIR/$ZIP_FILE.diffs for file in $DIFFING_FILES; do - if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then + if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs - fi + fi done if [ -s "$WORK_DIR/$ZIP_FILE.diffs" ]; then @@ -567,6 +568,10 @@ compare_bin_file() { $MKDIR -p $FILE_WORK_DIR + # Make soft links to original files from work dir to facilitate debugging + $LN -f -s $THIS_FILE $WORK_FILE_BASE.this + $LN -f -s $OTHER_FILE $WORK_FILE_BASE.other + ORIG_THIS_FILE="$THIS_FILE" ORIG_OTHER_FILE="$OTHER_FILE" @@ -583,57 +588,58 @@ compare_bin_file() { fi if [ "$OPENJDK_TARGET_OS" = "windows" ]; then - unset _NT_SYMBOL_PATH - # On windows we need to unzip the debug symbols, if present - OTHER_FILE_BASE=${OTHER_FILE/.dll/} - OTHER_FILE_BASE=${OTHER_FILE_BASE/.exe/} - DIZ_NAME=$(basename $OTHER_FILE_BASE).diz + unset _NT_SYMBOL_PATH + # On windows we need to unzip the debug symbols, if present + OTHER_FILE_BASE=${OTHER_FILE/.dll/} + OTHER_FILE_BASE=${OTHER_FILE_BASE/.exe/} + OTHER_FILE_BASE=${OTHER_FILE_BASE/.cpl/} + DIZ_NAME=$(basename $OTHER_FILE_BASE).diz # java.exe and java.dll diz files will have the same name. Have to - # make sure java.exe gets the right one. This is only needed for - # OTHER since in the new build, all pdb files are left around. - if [ "$NAME" = "java.exe" ] && [ -f "$OTHER/tmp/java/java/obj64/java.diz" ]; then - OTHER_DIZ_FILE="$OTHER/tmp/java/java/obj64/java.diz" - elif [ -f "${OTHER_FILE_BASE}.diz" ]; then - OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz - else + # make sure java.exe gets the right one. This is only needed for + # OTHER since in the new build, all pdb files are left around. + if [ "$NAME" = "java.exe" ] && [ -f "$OTHER/tmp/java/java/obj64/java.diz" ]; then + OTHER_DIZ_FILE="$OTHER/tmp/java/java/obj64/java.diz" + elif [ -f "${OTHER_FILE_BASE}.diz" ]; then + OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz + else # Some files, jli.dll, appears twice in the image but only one of - # thme has a diz file next to it. - OTHER_DIZ_FILE="$($FIND $OTHER_DIR -name $DIZ_NAME | $SED 1q)" - if [ ! -f "$OTHER_DIZ_FILE" ]; then - # As a last resort, look for diz file in the whole build output - # dir. - OTHER_DIZ_FILE="$($FIND $OTHER -name $DIZ_NAME | $SED 1q)" - fi - fi - if [ -n "$OTHER_DIZ_FILE" ]; then - $MKDIR -p $FILE_WORK_DIR/other - (cd $FILE_WORK_DIR/other ; $UNARCHIVE -o $OTHER_DIZ_FILE) - export _NT_SYMBOL_PATH="$FILE_WORK_DIR/other" - fi - THIS_FILE_BASE=${THIS_FILE/.dll/} - THIS_FILE_BASE=${THIS_FILE_BASE/.exe/} - if [ -f "${THIS_FILE/.dll/}.diz" ]; then - THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz - else - THIS_DIZ_FILE="$($FIND $THIS_DIR -name $DIZ_NAME | $SED 1q)" - if [ ! -f "$THIS_DIZ_FILE" ]; then - # As a last resort, look for diz file in the whole build output - # dir. - THIS_DIZ_FILE="$($FIND $THIS -name $DIZ_NAME | $SED 1q)" - fi - fi - if [ -n "$THIS_DIZ_FILE" ]; then - $MKDIR -p $FILE_WORK_DIR/this - (cd $FILE_WORK_DIR/this ; $UNARCHIVE -o $THIS_DIZ_FILE) - export _NT_SYMBOL_PATH="$_NT_SYMBOL_PATH;$FILE_WORK_DIR/this" - fi + # thme has a diz file next to it. + OTHER_DIZ_FILE="$($FIND $OTHER_DIR -name $DIZ_NAME | $SED 1q)" + if [ ! -f "$OTHER_DIZ_FILE" ]; then + # As a last resort, look for diz file in the whole build output + # dir. + OTHER_DIZ_FILE="$($FIND $OTHER -name $DIZ_NAME | $SED 1q)" + fi + fi + if [ -n "$OTHER_DIZ_FILE" ]; then + $MKDIR -p $FILE_WORK_DIR/other + (cd $FILE_WORK_DIR/other ; $UNARCHIVE -o $OTHER_DIZ_FILE) + export _NT_SYMBOL_PATH="$FILE_WORK_DIR/other" + fi + THIS_FILE_BASE=${THIS_FILE/.dll/} + THIS_FILE_BASE=${THIS_FILE_BASE/.exe/} + if [ -f "${THIS_FILE/.dll/}.diz" ]; then + THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz + else + THIS_DIZ_FILE="$($FIND $THIS_DIR -name $DIZ_NAME | $SED 1q)" + if [ ! -f "$THIS_DIZ_FILE" ]; then + # As a last resort, look for diz file in the whole build output + # dir. + THIS_DIZ_FILE="$($FIND $THIS -name $DIZ_NAME | $SED 1q)" + fi + fi + if [ -n "$THIS_DIZ_FILE" ]; then + $MKDIR -p $FILE_WORK_DIR/this + (cd $FILE_WORK_DIR/this ; $UNARCHIVE -o $THIS_DIZ_FILE) + export _NT_SYMBOL_PATH="$_NT_SYMBOL_PATH;$FILE_WORK_DIR/this" + fi fi if [ -z "$SKIP_BIN_DIFF" ]; then 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 @@ -664,19 +670,19 @@ compare_bin_file() { DIFF_SIZE_REL=$($EXPR $THIS_SIZE \* 100 / $OTHER_SIZE) SIZE_MSG=$($PRINTF "%3d%% %4d" $DIFF_SIZE_REL $DIFF_SIZE_NUM) if [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] && [ "$DIFF_SIZE_REL" -gt 98 ] \ - && [ "$DIFF_SIZE_REL" -lt 102 ]; then + && [ "$DIFF_SIZE_REL" -lt 102 ]; then SIZE_MSG="($SIZE_MSG)" DIFF_SIZE= elif [ "$OPENJDK_TARGET_OS" = "windows" ] \ - && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \ - && [ "$DIFF_SIZE_NUM" = 512 ]; then - # On windows, size of binaries increase in 512 increments. + && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \ + && [ "$DIFF_SIZE_NUM" = 512 ]; then + # On windows, size of binaries increase in 512 increments. SIZE_MSG="($SIZE_MSG)" DIFF_SIZE= elif [ "$OPENJDK_TARGET_OS" = "windows" ] \ - && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \ - && [ "$DIFF_SIZE_NUM" = -512 ]; then - # On windows, size of binaries increase in 512 increments. + && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \ + && [ "$DIFF_SIZE_NUM" = -512 ]; then + # On windows, size of binaries increase in 512 increments. SIZE_MSG="($SIZE_MSG)" DIFF_SIZE= else @@ -711,18 +717,18 @@ compare_bin_file() { if [ "$OPENJDK_TARGET_OS" = "windows" ]; then # The output from dumpbin on windows differs depending on if the debug symbol # files are still around at the location the binary is pointing too. Need - # to filter out that extra information. - $DUMPBIN -exports $OTHER_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other - $DUMPBIN -exports $THIS_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this + # to filter out that extra information. + $DUMPBIN -exports $OTHER_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other + $DUMPBIN -exports $THIS_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then # Some symbols get seemingly random 15 character prefixes. Filter them out. $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other - $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this + $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this else - $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other - $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this + $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other + $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this fi - + LC_ALL=C $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff if [ -s $WORK_FILE_BASE.symbols.diff ]; then SYM_MSG=" diff " @@ -735,7 +741,7 @@ compare_bin_file() { SYM_MSG=" $SYM_MSG " fi else - SYM_MSG="($SYM_MSG)" + SYM_MSG="($SYM_MSG)" DIFF_SYM= fi else @@ -748,48 +754,48 @@ compare_bin_file() { # Check dependencies if [ -n "$LDD_CMD" ]; then - (cd $FILE_WORK_DIR && $CP $OTHER_FILE . && $LDD_CMD $NAME 2>/dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.other | $UNIQ > $WORK_FILE_BASE.deps.other.uniq) - (cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME 2 $WORK_FILE_BASE.deps.this.uniq) - (cd $FILE_WORK_DIR && $RM -f $NAME) - - LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff - LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq - - if [ -s $WORK_FILE_BASE.deps.diff ]; then + (cd $FILE_WORK_DIR && $CP $OTHER_FILE . && $LDD_CMD $NAME 2>/dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.other | $UNIQ > $WORK_FILE_BASE.deps.other.uniq) + (cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME 2 $WORK_FILE_BASE.deps.this.uniq) + (cd $FILE_WORK_DIR && $RM -f $NAME) + + LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff + LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq + + if [ -s $WORK_FILE_BASE.deps.diff ]; then if [ -s $WORK_FILE_BASE.deps.diff.uniq ]; then - DEP_MSG=" diff " + DEP_MSG=" diff " else - DEP_MSG=" redun " + DEP_MSG=" redun " fi if [[ "$ACCEPTED_DEP_DIFF" != *"$BIN_FILE"* ]]; then - DIFF_DEP=true - if [[ "$KNOWN_DEP_DIFF" != *"$BIN_FILE"* ]]; then + DIFF_DEP=true + if [[ "$KNOWN_DEP_DIFF" != *"$BIN_FILE"* ]]; then DEP_MSG="*$DEP_MSG*" REGRESSIONS=true - else + else DEP_MSG=" $DEP_MSG " - fi + fi else - DEP_MSG="($DEP_MSG)" - DIFF_DEP= + DEP_MSG="($DEP_MSG)" + DIFF_DEP= fi - else - DEP_MSG=" " - DIFF_DEP= + else + DEP_MSG=" " + DIFF_DEP= if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then DEP_MSG=" ! " fi - fi + fi else - DEP_MSG=" - " + DEP_MSG=" - " fi - + # Compare fulldump output if [ -n "$FULLDUMP_CMD" ] && [ -z "$SKIP_FULLDUMP_DIFF" ]; then $FULLDUMP_CMD $OTHER_FILE > $WORK_FILE_BASE.fulldump.other 2>&1 $FULLDUMP_CMD $THIS_FILE > $WORK_FILE_BASE.fulldump.this 2>&1 LC_ALL=C $DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this > $WORK_FILE_BASE.fulldump.diff - + if [ -s $WORK_FILE_BASE.fulldump.diff ]; then ELF_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.fulldump.diff | awk '{print $5}') ELF_MSG=$($PRINTF "%8d" $ELF_DIFF_SIZE) @@ -816,14 +822,17 @@ compare_bin_file() { # Compare disassemble output if [ -n "$DIS_CMD" ] && [ -z "$SKIP_DIS_DIFF" ]; then - if [ -z "$DIS_DIFF_FILTER" ]; then - DIS_DIFF_FILTER="$CAT" - fi - $DIS_CMD $OTHER_FILE | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.other 2>&1 - $DIS_CMD $THIS_FILE | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.this 2>&1 - + # By default we filter out differences that include references to symbols. + # To get a raw diff with the complete disassembly, set + # DIS_DIFF_FILTER="$CAT" + if [ -z "$DIS_DIFF_FILTER" ]; then + DIS_DIFF_FILTER="$GREP -v ' # .* <.*>$'" + fi + $DIS_CMD $OTHER_FILE | $GREP -v $NAME | eval "$DIS_DIFF_FILTER" > $WORK_FILE_BASE.dis.other 2>&1 + $DIS_CMD $THIS_FILE | $GREP -v $NAME | eval "$DIS_DIFF_FILTER" > $WORK_FILE_BASE.dis.this 2>&1 + LC_ALL=C $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff - + if [ -s $WORK_FILE_BASE.dis.diff ]; then DIS_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.dis.diff | awk '{print $5}') DIS_MSG=$($PRINTF "%8d" $DIS_DIFF_SIZE) @@ -901,7 +910,9 @@ compare_all_libs() { OTHER_DIR=$2 WORK_DIR=$3 - LIBS=$(cd $THIS_DIR && $FIND . -type f \( -name 'lib*.so' -o -name '*.dylib' -o -name '*.dll' -o -name 'JavaControlPanel' \) | $SORT | $FILTER) + LIBS=$(cd $THIS_DIR && $FIND . -type f \( -name 'lib*.so' -o -name '*.dylib' \ + -o -name '*.dll' -o -name '*.obj' -o -name '*.o' \ + -o -name '*.cpl' \) | $SORT | $FILTER) if [ -n "$LIBS" ]; then echo Libraries... @@ -961,7 +972,7 @@ COMPARE_ROOT=/tmp/cimages.$USER $MKDIR -p $COMPARE_ROOT if [ "$OPENJDK_TARGET_OS" = "windows" ]; then if [ "$(uname -o)" = "Cygwin" ]; then - COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT) + COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT) fi fi @@ -1085,7 +1096,7 @@ while [ -n "$1" ]; do CMP_JARS=true CMP_LIBS=true CMP_EXECS=true - + if [ -z "$FILTER" ]; then FILTER="$GREP" fi @@ -1136,17 +1147,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 +1162,47 @@ 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 + # Find the common images to compare, prioritizing later build stages + if [ -d "$THIS/install/j2sdk-image" ] && [ -d "$OTHER/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" - 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 + echo "Selecting install images for compare" + elif [ -d "$THIS/deploy/j2sdk-image" ] && [ -d "$OTHER/deploy/j2sdk-image" ]; then + THIS_J2SDK="$THIS/deploy/j2sdk-image" + THIS_J2RE="$THIS/deploy/j2re-image" 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 + echo "Selecting deploy images for compare" + elif [ -d "$THIS/images/j2sdk-image" ] && [ -d "$OTHER/images/j2sdk-image" ]; then + THIS_J2SDK="$THIS/images/j2sdk-image" + THIS_J2RE="$THIS/images/j2re-image" 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!" + echo "Selecting jdk images for compare" + else + echo "No common images found." 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/j2sdk-bundle" ] && [ -d "$OTHER/images/j2sdk-bundle" ]; then + THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle" + THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle" + OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle" + OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle" + echo "Also comparing macosx bundles" + fi + + if [ -d "$THIS/deploy" ] && [ -d "$OTHER/deploy" ]; then + THIS_DEPLOY_BUNDLE_DIR="$THIS/deploy/dist/installer/bundles" + OTHER_DEPLOY_BUNDLE_DIR="$OTHER/deploy/bundles" + echo "Also comparing deploy/bundles" + if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then + THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/JavaAppletPlugin.plugin" + OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/JavaAppletPlugin.plugin" + echo "Also comparing JavaAppletPlugin" + fi fi if [ -d "$OTHER/images" ]; then @@ -1266,22 +1225,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 ########################################################################################## @@ -1293,29 +1243,18 @@ if [ "$CMP_NAMES" = "true" ]; then compare_dirs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk echo -n "J2RE " compare_dirs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re - + echo -n "J2SDK " compare_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk 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 echo -n "J2RE Bundle " compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle - + echo -n "J2SDK Bundle " compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle echo -n "J2RE Bundle " @@ -1331,6 +1270,12 @@ if [ "$CMP_NAMES" = "true" ]; then compare_dirs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir compare_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + echo -n "JavaAppletPlugin " + compare_dirs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + echo -n "JavaAppletPlugin " + compare_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi if [ "$CMP_PERMS" = "true" ]; then @@ -1340,21 +1285,13 @@ 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 + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + echo -n "JavaAppletPlugin " + compare_permissions $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi if [ "$CMP_TYPES" = "true" ]; then @@ -1364,12 +1301,6 @@ 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 @@ -1379,6 +1310,10 @@ if [ "$CMP_TYPES" = "true" ]; then if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then compare_file_types $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + echo -n "JavaAppletPlugin " + compare_file_types $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi if [ "$CMP_GENERAL" = "true" ]; then @@ -1388,12 +1323,6 @@ 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 @@ -1407,6 +1336,10 @@ if [ "$CMP_GENERAL" = "true" ]; then if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then compare_general_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + echo -n "JavaAppletPlugin " + compare_general_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi if [ "$CMP_ZIPS" = "true" ]; then @@ -1434,6 +1367,12 @@ if [ "$CMP_ZIPS" = "true" ]; then if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then compare_all_zip_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi + if [ -n "$THIS_DEPLOY_BUNDLE_DIR" ] && [ -n "$OTHER_DEPLOY_BUNDLE_DIR" ]; then + compare_all_zip_files $THIS_DEPLOY_BUNDLE_DIR $OTHER_DEPLOY_BUNDLE_DIR $COMPARE_ROOT/deploy-bundle + fi + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + compare_all_zip_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi if [ "$CMP_JARS" = "true" ]; then @@ -1443,6 +1382,9 @@ if [ "$CMP_JARS" = "true" ]; then if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then compare_all_jar_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + compare_all_jar_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi if [ "$CMP_LIBS" = "true" ]; then @@ -1454,26 +1396,30 @@ 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 + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + echo -n "JavaAppletPlugin " + compare_all_libs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi 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 + if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then + echo -n "J2RE " + compare_all_execs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re + fi 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 + if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then + echo -n "JavaAppletPlugin " + compare_all_execs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + fi fi echo diff --git a/common/bin/compare_exceptions.sh.incl b/common/bin/compare_exceptions.sh.incl index cace701b788..de986ef8e59 100644 --- a/common/bin/compare_exceptions.sh.incl +++ b/common/bin/compare_exceptions.sh.incl @@ -85,6 +85,7 @@ ACCEPTED_BIN_DIFF=" ./bin/jdb ./bin/jhat ./bin/jinfo +./bin/jjs ./bin/jmap ./bin/jps ./bin/jrunscript @@ -108,6 +109,7 @@ ACCEPTED_BIN_DIFF=" ./bin/wsimport ./bin/xjc ./jre/bin/java +./jre/bin/jjs ./jre/bin/keytool ./jre/bin/orbd ./jre/bin/pack200 @@ -172,6 +174,7 @@ ACCEPTED_BIN_DIFF=" ./bin/jdb ./bin/jhat ./bin/jinfo +./bin/jjs ./bin/jmap ./bin/jps ./bin/jrunscript @@ -195,6 +198,7 @@ ACCEPTED_BIN_DIFF=" ./bin/wsimport ./bin/xjc ./jre/bin/java +./jre/bin/jjs ./jre/bin/keytool ./jre/bin/orbd ./jre/bin/pack200 @@ -910,11 +914,6 @@ ACCEPTED_JARZIP_CONTENTS=" /META-INF/INDEX.LIST " -KNOWN_BIN_DIFF=" -./jre/lib/libJObjC.dylib -./lib/libJObjC.dylib -" - ACCEPTED_BIN_DIFF=" ./bin/appletviewer ./bin/idlj @@ -964,34 +963,82 @@ ACCEPTED_BIN_DIFF=" ./jre/bin/tnameserv ./jre/lib/libsaproc.dylib ./jre/lib/server/libjvm.dylib +./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.dylib +./demo/jvmti/gctest/lib/libgctest.dylib +./demo/jvmti/heapTracker/lib/libheapTracker.dylib +./demo/jvmti/heapViewer/lib/libheapViewer.dylib +./demo/jvmti/minst/lib/libminst.dylib +./demo/jvmti/mtrace/lib/libmtrace.dylib +./demo/jvmti/versionCheck/lib/libversionCheck.dylib +./demo/jvmti/waiters/lib/libwaiters.dylib +./Contents/Home/lib/libAppleScriptEngine.dylib +./Contents/Home/lib/libattach.dylib +./Contents/Home/lib/libawt_lwawt.dylib +./Contents/Home/lib/libdeploy.dylib +./Contents/Home/lib/libdt_socket.dylib +./Contents/Home/lib/libhprof.dylib +./Contents/Home/lib/libinstrument.dylib +./Contents/Home/lib/libjava_crw_demo.dylib +./Contents/Home/lib/libjdwp.dylib +./Contents/Home/lib/libjsdt.dylib +./Contents/Home/lib/libjsig.dylib +./Contents/Home/lib/libmanagement.dylib +./Contents/Home/lib/libnpjp2.dylib +./Contents/Home/lib/libosx.dylib +./Contents/Home/lib/libosxapp.dylib +./Contents/Home/lib/libsaproc.dylib +./Contents/Home/lib/libsplashscreen.dylib +./Contents/Home/lib/libverify.dylib +./Contents/Home/lib/server/libjsig.dylib +./Contents/Home/lib/server/libjvm.dylib +./jre/lib/libAppleScriptEngine.dylib +./jre/lib/libattach.dylib +./jre/lib/libawt_lwawt.dylib +./jre/lib/libdeploy.dylib +./jre/lib/libdt_socket.dylib +./jre/lib/libhprof.dylib +./jre/lib/libinstrument.dylib +./jre/lib/libjava_crw_demo.dylib +./jre/lib/libjdwp.dylib +./jre/lib/libjsdt.dylib +./jre/lib/libjsig.dylib +./jre/lib/libmanagement.dylib +./jre/lib/libosx.dylib +./jre/lib/libosxapp.dylib +./jre/lib/libsaproc.dylib +./jre/lib/libsplashscreen.dylib +./jre/lib/libverify.dylib +./jre/lib/server/libjvm.dylib +./lib/libAppleScriptEngine.dylib +./lib/libattach.dylib +./lib/libawt_lwawt.dylib +./lib/libdeploy.dylib +./lib/libdt_socket.dylib +./lib/libhprof.dylib +./lib/libinstrument.dylib +./lib/libjava_crw_demo.dylib +./lib/libjdwp.dylib +./lib/libjsdt.dylib +./lib/libjsig.dylib +./lib/libmanagement.dylib +./lib/libnpjp2.dylib +./lib/libosx.dylib +./lib/libosxapp.dylib +./lib/libverify.dylib ./lib/libsaproc.dylib +./lib/libsplashscreen.dylib ./lib/server/libjvm.dylib ./lib/deploy/JavaControlPanel.prefPane/Contents/MacOS/JavaControlPanel " -KNOWN_SIZE_DIFF=" -./jre/lib/libJObjC.dylib -./lib/libJObjC.dylib -" - SORT_SYMBOLS=" -./jre/lib/libJObjC.dylib -./lib/libJObjC.dylib +./Contents/Home/lib/libsaproc.dylib +./jre/lib/libsaproc.dylib +./lib/libsaproc.dylib " -KNOWN_SYM_DIFF=" -./jre/lib/libJObjC.dylib -./lib/libJObjC.dylib +ACCEPTED_SMALL_SIZE_DIFF=" +./bin/javaws +./Contents/Home/bin/_javaws " - -KNOWN_ELF_DIFF=" -./jre/lib/libJObjC.dylib -./lib/libJObjC.dylib -" - -KNOWN_DIS_DIFF=" -./jre/lib/libJObjC.dylib -./lib/libJObjC.dylib -" - fi diff --git a/common/bin/logger.sh b/common/bin/logger.sh index 46ab48ae47b..7fbc7816d81 100644 --- a/common/bin/logger.sh +++ b/common/bin/logger.sh @@ -22,10 +22,10 @@ # questions. # -# Usage: ./logger.sh theloggfile acommand arg1 arg2 +# Usage: ./logger.sh theloggfile acommand arg1 arg2 # # Execute acommand with args, in such a way that -# both stdout and stderr from acommand are appended to +# both stdout and stderr from acommand are appended to # theloggfile. # # Preserve stdout and stderr, so that the stdout diff --git a/common/bin/shell-tracer.sh b/common/bin/shell-tracer.sh index 27a964c977e..5c7cc449f9c 100644 --- a/common/bin/shell-tracer.sh +++ b/common/bin/shell-tracer.sh @@ -26,12 +26,12 @@ # # This shell script is supposed to be set as a replacement for SHELL in make, # causing it to be called whenever make wants to execute shell commands. -# The is suitable for passing on to the old shell, +# The is suitable for passing on to the old shell, # typically beginning with -c. # -# This script will make sure the shell command line is executed with +# This script will make sure the shell command line is executed with # OLD_SHELL -x, and it will also store a simple log of the the time it takes to -# execute the command in the OUTPUT_FILE, using the "time" utility as pointed +# execute the command in the OUTPUT_FILE, using the "time" utility as pointed # to by TIME_CMD. If TIME_CMD is "-", no timestamp will be stored. TIME_CMD="$1" diff --git a/common/bin/test_builds.sh b/common/bin/test_builds.sh index 911008020c9..674693576ab 100644 --- a/common/bin/test_builds.sh +++ b/common/bin/test_builds.sh @@ -171,7 +171,7 @@ checkErrors ) 2>&1 | tee ${t3}.build.txt checkErrors -# Compare old build to build-infra build +# Compare old build to build-infra build ( \ sh ${t0}/common/bin/compareimage.sh \ ${t3}/build/*/j2sdk-image \ @@ -181,4 +181,3 @@ checkErrors checkErrors exit 0 - diff --git a/common/bin/unshuffle_patch.sh b/common/bin/unshuffle_patch.sh index f380fb6f2f1..a61864cbd3f 100644 --- a/common/bin/unshuffle_patch.sh +++ b/common/bin/unshuffle_patch.sh @@ -80,7 +80,7 @@ for r in $repos ; do if [ $repo = "$r" ] ; then found="true" break; - fi + fi done if [ $found = "false" ] ; then echo "ERROR: Unknown repo: $repo. Should be one of [$repos]." >&2 @@ -200,4 +200,3 @@ do printf "%s\n" "$line" >> $output fi done < "$input" - diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk index b8f792d3c3d..3d78cebef1e 100644 --- a/make/CompileJavaModules.gmk +++ b/make/CompileJavaModules.gmk @@ -321,7 +321,7 @@ jdk.compiler_COPY := javax.tools.JavaCompilerTool ################################################################################ -jdk.jcmd_COPY := _options +jdk.jcmd_COPY := _options ################################################################################ @@ -470,7 +470,7 @@ define SetupModuleCompilation $1_DEPS := $$(call FindDepsForModule, $1) $1_CLASSPATH := $$(addprefix $(JDK_OUTPUTDIR)/modules/,$$($1_DEPS)) - # When crypto classes are prebuilt, need to look for classes already in + # When crypto classes are prebuilt, need to look for classes already in # output dir. ifneq ($(BUILD_CRYPTO), true) $1_CLASSPATH += $(JDK_OUTPUTDIR)/modules/$1 @@ -495,7 +495,7 @@ define SetupModuleCompilation # Declare dependencies between java compilation of different modules. # Since not all modules have been declared yet, or might be declared - # in different invocations of this file, use the macro to find the + # in different invocations of this file, use the macro to find the # correct target file to depend on. # Only the javac compilation actually depends on other modules so limit # dependency declaration to that by using the *_COMPILE_TARGET variable. diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk index cba9d666ad2..e9bd588e17b 100644 --- a/make/Javadoc.gmk +++ b/make/Javadoc.gmk @@ -481,7 +481,7 @@ $(DOCLETAPI_OPTIONS_FILE): ) >> $@ # Create a file with the package names in it -$(DOCLETAPI_PACKAGES_FILE): $(call PackageDependencies,$(DOCLETAPI_PKGS)) +$(DOCLETAPI_PACKAGES_FILE): $(call PackageDependencies,$(DOCLETAPI_PKGS)) $(prep-target) $(call PackageFilter,$(DOCLETAPI_PKGS)) diff --git a/make/Main.gmk b/make/Main.gmk index 96e322ef96d..1b0038fc969 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -43,7 +43,7 @@ include $(SRC_ROOT)/make/common/Modules.gmk 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 +# valid top level targets. It's used to declare them all as PHONY and to # generate the -only targets. ALL_TARGETS := @@ -314,9 +314,9 @@ ALL_TARGETS += install ################################################################################ # -# Dependency declarations between targets. +# Dependency declarations between targets. # -# These are declared in two groups. First all dependencies between targets that +# These are declared in two groups. First all dependencies between targets that # have recipes above as these dependencies may be disabled. Then the aggregator # targets that do not have recipes of their own, which will never have their # dependencies disabled. @@ -324,10 +324,10 @@ ALL_TARGETS += install ################################################################################ # Targets with recipes above -# If running an *-only target, parallel execution and dependencies between -# recipe targets are disabled. This makes it possible to run a select set of +# If running an *-only target, parallel execution and dependencies between +# recipe targets are disabled. This makes it possible to run a select set of # recipe targets in order. It's the responsibility of the user to make sure -# all prerequisites are fulfilled. +# all prerequisites are fulfilled. ifneq ($(findstring -only, $(MAKECMDGOALS)), ) .NOTPARALLEL: else @@ -376,11 +376,11 @@ else # Declare dependencies from all other -lib to java.base-lib $(foreach t, $(filter-out java.base-libs, $(LIB_TARGETS)), \ $(eval $t: java.base-libs)) - # Declare the special case dependency for jdk.deploy.osx where libosx + # 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 + # 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 @@ -493,7 +493,7 @@ ALL_TARGETS += default all # Clean targets # ################################################################################ -# Clean targets are automatically run serially by the Makefile calling this +# Clean targets are automatically run serially by the Makefile calling this # file. CLEAN_COMPONENTS += langtools corba hotspot jdk nashorn images \ @@ -529,8 +529,8 @@ ALL_TARGETS += clean dist-clean $(CLEAN_TARGETS) ################################################################################ -# Setup a rule for SPEC file that fails if executed. This check makes sure the -# configuration is up to date after changes to configure. +# Setup a rule for SPEC file that fails if executed. This check makes sure the +# configuration is up to date after changes to configure. ifeq ($(findstring reconfigure, $(MAKECMDGOALS)), ) $(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*) @$(ECHO) "ERROR: $(SPEC) is not up to date." diff --git a/make/MakeHelpers.gmk b/make/MakeHelpers.gmk index 62b9add30cd..72daed14298 100644 --- a/make/MakeHelpers.gmk +++ b/make/MakeHelpers.gmk @@ -228,25 +228,26 @@ define ParseConfAndSpec # If we only have global targets, no need to bother with SPEC or CONF ifneq ($$(origin SPEC),undefined) # We have been given a SPEC, check that it works out properly - ifeq ($$(wildcard $$(SPEC)),) - $$(info Cannot locate spec.gmk, given by SPEC=$$(SPEC)) - $$(eval $$(call FatalError)) - endif ifneq ($$(origin CONF),undefined) # We also have a CONF argument. This is OK only if this is a repeated call by ourselves, # but complain if this is the top-level make call. ifeq ($$(MAKELEVEL),0) - $$(info Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.) + $$(info Error: Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.) $$(eval $$(call FatalError)) endif endif + ifeq ($$(wildcard $$(SPEC)),) + $$(info Error: Cannot locate spec.gmk, given by SPEC=$$(SPEC).) + $$(eval $$(call FatalError)) + endif # ... OK, we're satisfied, we'll use this SPEC later on else # Find all spec.gmk files in the build output directory output_dir=$$(root_dir)/build all_spec_files=$$(wildcard $$(output_dir)/*/spec.gmk) ifeq ($$(all_spec_files),) - $$(info No configurations found for $$(root_dir)! Please run configure to create a configuration.) + $$(info Error: No configurations found for $$(root_dir).) + $$(info Please run 'bash configure' to create a configuration.) $$(eval $$(call FatalError)) endif # Extract the configuration names from the path @@ -262,15 +263,15 @@ define ParseConfAndSpec matching_confs=$$(strip $$(foreach var,$$(all_confs),$$(if $$(findstring $$(CONF),$$(var)),$$(var)))) endif ifeq ($$(matching_confs),) - $$(info No configurations found matching CONF=$$(CONF)) - $$(info Available configurations:) + $$(info Error: No configurations found matching CONF=$$(CONF).) + $$(info Available configurations in $$(output_dir):) $$(foreach var,$$(all_confs),$$(info * $$(var))) $$(eval $$(call FatalError)) else ifeq ($$(words $$(matching_confs)),1) $$(info Building '$$(matching_confs)' (matching CONF=$$(CONF))) else - $$(info Building target '$(call GetRealTarget)' in the following configurations (matching CONF=$$(CONF)):) + $$(info Building target '$(call GetRealTarget)' in these configurations (matching CONF=$$(CONF)):) $$(foreach var,$$(matching_confs),$$(info * $$(var))) endif endif @@ -280,10 +281,10 @@ define ParseConfAndSpec else # No CONF or SPEC given, check the available configurations ifneq ($$(words $$(all_spec_files)),1) - $$(info No CONF given, but more than one configuration found in $$(output_dir).) - $$(info Available configurations:) + $$(info Error: No CONF given, but more than one configuration found.) + $$(info Available configurations in $$(output_dir):) $$(foreach var,$$(all_confs),$$(info * $$(var))) - $$(info Please retry building with CONF= (or SPEC=)) + $$(info Please retry building with CONF= (or SPEC=).) $$(eval $$(call FatalError)) endif diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk index 27846c0a924..3c89bf7f98a 100644 --- a/make/common/JavaCompilation.gmk +++ b/make/common/JavaCompilation.gmk @@ -166,7 +166,7 @@ define SetupArchiveInner ifneq (,$2) $1_DEPS:=$2 else - # Add all source roots to the find cache since we are likely going to run find + # Add all source roots to the find cache since we are likely going to run find # on these more than once. The cache will only be updated if necessary. $$(eval $$(call FillCacheFind, $$($1_FIND_LIST))) $1_DEPS:=$$(filter $$(addprefix %,$$($1_SUFFIXES)), \ @@ -336,7 +336,7 @@ endef # # The sed expression does this: # 1. Add a backslash before any :, = or ! that do not have a backslash already. -# 2. Apply the file unicode2x.sed which does a whole bunch of \u00XX to \xXX +# 2. Apply the file unicode2x.sed which does a whole bunch of \u00XX to \xXX # conversions. # 3. Delete all lines starting with #. # 4. Delete empty lines. @@ -345,7 +345,7 @@ endef # as sed on macosx does not understand '\t'. # 7. Replace the first \= with just =. # 8. Finally it's all sorted to create a stable output. -# +# # It is assumed that = is the character used for separating names and values. define add_file_to_clean # param 1 = BUILD_MYPACKAGE @@ -431,7 +431,7 @@ define SetupJavaCompilationInner # Make sure the dirs exist. $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupJavaCompilation $1 contains missing directory $$d))) $$(eval $$(call MakeDir,$$($1_BIN))) - # Add all source roots to the find cache since we are likely going to run find + # Add all source roots to the find cache since we are likely going to run find # on these more than once. The cache will only be updated if necessary. $$(eval $$(call FillCacheFind,$$($1_SRC))) # Find all files in the source trees. Preserve order of source roots for overrides to diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index ee02322a2d4..b45fd52d5cd 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -405,7 +405,7 @@ ifeq ($(OPENJDK_TARGET_OS),solaris) # If the source and target parent directories are the same, recursive copy doesn't work # so we fall back on regular copy, which isn't preserving symlinks. define install-file - $(MKDIR) -p $(@D) + $(MKDIR) -p '$(@D)' $(RM) '$@' if [ "$(@D)" != "$( REPLACEMENT_TEXT ; ... # -# At least one of INCLUDES or REPLACEMENTS must be present. If both are -# present, then the includes will be processed first, and replacements will be -# done on the included fragments as well. +# If both INCLUDES or REPLACEMENTS are present, then the includes will be +# processed first, and replacements will be done on the included fragments as well. +# If neither is present, the files will just be copied without modifications. # define SetupTextFileProcessing $(if $(16),$(error Internal makefile error: Too many arguments to SetupTextFileProcessing, please update TextFileProcessing.gmk)) @@ -87,10 +87,6 @@ define SetupTextFileProcessingInner $(call LogSetupMacroEntry,SetupTextFileProcessing($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) $(if $(16),$(error Internal makefile error: Too many arguments to SetupTextFileProcessing, please update TextFileProcessing.gmk)) - ifeq ($$($1_REPLACEMENTS)$$($1_INCLUDES),) - $$(error At least one of REPLACEMENTS or INCLUDES are required for $1) - endif - ifneq ($$($1_SOURCE_FILES),) ifneq ($$($1_SOURCE_DIRS),) $$(error Cannot use both SOURCE_FILES and SOURCE_DIRS (in $1)) @@ -102,6 +98,9 @@ define SetupTextFileProcessingInner $$(error Cannot INCLUDE/EXCLUDE_FILES with SOURCE_FILES (in $1)) endif else + ifeq ($$($1_SOURCE_DIRS),) + $$(error Must specify either SOURCE_FILES or SOURCE_DIRS (in $1)) + endif # Find all files in the source trees. Sort to remove duplicates. $$(foreach src, $$($1_SOURCE_DIRS), $$(if $$(wildcard $$(src)), , \ $$(error SOURCE_DIRS contains missing directory $$(src) (in $1)))) @@ -154,7 +153,7 @@ define SetupTextFileProcessingInner $1_REPLACEMENTS += ; endif - # If we have a trailing ";", add a dummy replacement, since there is no easy + # If we have a trailing ";", add a dummy replacement, since there is no easy # way to delete the last word in make. ifeq ($$(lastword $$($1_REPLACEMENTS)), ;) $1_REPLACEMENTS += DUMMY_REPLACEMENT => DUMMY_REPLACEMENT @@ -163,11 +162,11 @@ define SetupTextFileProcessingInner # Convert the REPLACEMENTS syntax ( A => B ; C => D ; ...) to a sed command # line (-e "s/A/B/" -e "s/C/D/" ...), basically by replacing '=>' with '/' # and ';' with '/" -e "s/', and adjusting for edge cases. - $1_REPLACEMENTS_COMMAND_LINE := $(SED) -e "s$$($1_SEP)$$(subst $$(SPACE);$$(SPACE),$$($1_SEP)" \ - -e "s$$($1_SEP),$$(subst $$(SPACE)=>$$(SPACE),$$($1_SEP),$$(subst $$(SPACE)=>$$(SPACE);$$(SPACE),//" \ - -e "s$$($1_SEP),$$(strip $$($1_REPLACEMENTS)))))$$($1_SEP)" + $1_REPLACEMENTS_COMMAND_LINE := $(SED) -e 's$$($1_SEP)$$(subst $$(SPACE);$$(SPACE),$$($1_SEP)' \ + -e 's$$($1_SEP),$$(subst $$(SPACE)=>$$(SPACE),$$($1_SEP),$$(subst $$(SPACE)=>$$(SPACE);$$(SPACE),$$($1_SEP)$$($1_SEP)' \ + -e 's$$($1_SEP),$$(strip $$($1_REPLACEMENTS)))))$$($1_SEP)' else - # We don't have any replacements, just pipe the file through cat. + # We don't have any replacements, just pipe the file through cat. $1_REPLACEMENTS_COMMAND_LINE := $(CAT) endif @@ -176,8 +175,8 @@ define SetupTextFileProcessingInner # Convert an INCLUDE like this PATTERN_1 => file1 ; PATTERN_2 => file2 ; # into an awk script fragment like this: # { - # if (matches("PATTERN_1")) { include("file1") } else - # if (matches("PATTERN_2")) { include("file2") } else + # if (matches("PATTERN_1")) { include("file1") } else + # if (matches("PATTERN_2")) { include("file2") } else # print # } @@ -190,12 +189,12 @@ define SetupTextFileProcessingInner $1_INCLUDES_COMMAND_LINE := $(NAWK) '$$($1_INCLUDES_HEADER_AWK) \ { if (matches("$$($1_INCLUDES_PARTIAL_AWK)") } else print }' else - # We don't have any includes, just pipe the file through cat. + # We don't have any includes, just pipe the file through cat. $1_INCLUDES_COMMAND_LINE := $(CAT) endif # Reset target list before populating it - $1 := + $1 := ifneq ($$($1_OUTPUT_FILE),) ifneq ($$(words $$($1_SOURCE_FILES)), 1) @@ -204,7 +203,7 @@ define SetupTextFileProcessingInner # Note that $1 is space sensitive and must disobey whitespace rules $$(eval $$(call SetupSingleTextFileForProcessing,$1, $$($1_SOURCE_FILES), \ - $$(dir $$($1_OUTPUT_FILE)), $$(notdir $$($1_OUTPUT_FILE)))) + $$(patsubst %/, %, $$(dir $$($1_OUTPUT_FILE))), $$(notdir $$($1_OUTPUT_FILE)))) else ifeq ($$($1_OUTPUT_DIR),) $$(error Neither OUTPUT_FILE nor OUTPUT_DIR was specified (in $1)) @@ -212,19 +211,20 @@ define SetupTextFileProcessingInner # Now call add_native_source for each source file we are going to process. ifeq ($$($1_SOURCE_BASE_DIR),) - # With no base dir specified, put all files in target dir, flattening any + # With no base dir specified, put all files in target dir, flattening any # hierarchies. Note that $1 is space sensitive and must disobey whitespace # rules. $$(foreach src, $$($1_SOURCE_FILES), \ $$(eval $$(call SetupSingleTextFileForProcessing,$1, $$(src), \ - $$($1_OUTPUT_DIR), $$(notdir $$(src))))) + $$(patsubst %/, %, $$($1_OUTPUT_DIR)), $$(notdir $$(src))))) else # With a base dir, extract the relative portion of the path. Note that $1 # is space sensitive and must disobey whitespace rules, and so is the # arguments to patsubst. $$(foreach src, $$($1_SOURCE_FILES), \ $$(eval $$(call SetupSingleTextFileForProcessing,$1, $$(src), \ - $$($1_OUTPUT_DIR), $$(patsubst $$($1_SOURCE_BASE_DIR)/%,%,$$(src))))) + $$(patsubst %/, %, $$($1_OUTPUT_DIR)), \ + $$(patsubst $$($1_SOURCE_BASE_DIR)/%,%,$$(src))))) endif endif endef diff --git a/make/jprt.properties b/make/jprt.properties index dbe27081b20..368afe4ccf6 100644 --- a/make/jprt.properties +++ b/make/jprt.properties @@ -154,7 +154,7 @@ my.make.rule.test.targets.default= \ ${my.test.target.set:TESTNAME=jdk_lang}, \ ${my.test.target.set:TESTNAME=jdk_math}, \ ${my.test.target.set:TESTNAME=jdk_util} - + # Default vm test targets (testset=core) my.test.targets.core= diff --git a/make/scripts/normalizer.pl b/make/scripts/normalizer.pl index 184248aa016..28aeff2bb58 100644 --- a/make/scripts/normalizer.pl +++ b/make/scripts/normalizer.pl @@ -32,7 +32,7 @@ if ($#ARGV < 0) { &usage; - + die; } @@ -99,7 +99,7 @@ sub parse_file { # Skip directories return if -d; - + # Skip SCCS files return if ($filename =~ /\/SCCS\//); @@ -121,18 +121,18 @@ sub parse_file { chdir $dirname; open(FILE, $filename) or die "Failed while open $filename: $!\n"; - + # Read file my @content; my $line; my $emptylinescount = 0; my $modified = 0; - + while ($line = ) { my $originalline = $line; # Process line - + # Remove from the end of the line spaces and return character while ($line =~ /\s$/) { chop($line); @@ -144,16 +144,16 @@ sub parse_file { $line = substr($line, 0, $i) . $tabvalues[7 - ($i % 8)] . substr($line, $i + 1); } } - + if (length($line) == 0) { $emptylinescount++; } else { while ($emptylinescount > 0) { push(@content, ""); - + $emptylinescount--; } - + push(@content, $line); } @@ -162,23 +162,23 @@ sub parse_file { } } - + $allfiles++; - + if ($emptylinescount > 0) { $modified = 1; } close(FILE); - + if ($modified != 0) { # Write file open(FILE, ">$filename") or die "Failed while open $filename: $!\n"; - + for (my $i = 0; $i <= $#content; $i++) { print FILE "$content[$i]\n"; } - + close(FILE); # Print name from current dir @@ -204,5 +204,3 @@ sub usage { print "Examples:\n"; print " normalizer.pl -e c,cpp,h,hpp .\n"; } - - diff --git a/make/scripts/update_copyright_year.sh b/make/scripts/update_copyright_year.sh index a3df5d0fdf6..948f80d6acb 100644 --- a/make/scripts/update_copyright_year.sh +++ b/make/scripts/update_copyright_year.sh @@ -196,4 +196,3 @@ fi # Cleanup rm -f -r ${tmp} exit 0 - From 7b35db48f7ce7d45d736012b2ead79f4b8128f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Thu, 27 Nov 2014 16:42:53 +0100 Subject: [PATCH 102/138] 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 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(new LexicalContext()) { @Override protected boolean enterDefault(final Node node) { @@ -200,16 +200,17 @@ final class AssignSymbols extends NodeVisitor 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 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 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 { /** 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 { * @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 { 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 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; * */ -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: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: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: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: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:1:9 Expected statement but found let declaration +for (;;) let x = 1; + ^ +SyntaxError: test/script/basic/es6/let-const-statement-context.js#34:8:1:9 Expected statement but found const declaration +for (;;) const x = 1; + ^ +SyntaxError: test/script/basic/es6/let-const-statement-context.js#34:8: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: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: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: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: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: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 9c7f48c842eabe5254dccbccc350d17c9affe4d6 Mon Sep 17 00:00:00 2001 From: Marcus Lagergren Date: Fri, 28 Nov 2014 11:02:54 +0100 Subject: [PATCH 103/138] 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 Date: Fri, 28 Nov 2014 11:45:56 +0000 Subject: [PATCH 104/138] 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 trees, Env env, ListBuffer argtypes) { - boolean polykind = false; + KindSelector attribArgs(KindSelector initialKind, List trees, Env env, ListBuffer 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 argtypesBuf = new ListBuffer<>(); final KindSelector pkind = - attribArgs(tree.args, localEnv, argtypesBuf); + attribArgs(KindSelector.VAL, tree.args, localEnv, argtypesBuf); List argtypes = argtypesBuf.toList(); List 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, 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,{(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, 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 Date: Fri, 28 Nov 2014 18:31:05 +0530 Subject: [PATCH 105/138] 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 := Nashorn API +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 beb05bda0df684f58c6b83a973b41c2c146e629d Mon Sep 17 00:00:00 2001 From: Andreas Gabrielsson Date: Mon, 1 Dec 2014 13:17:24 +0100 Subject: [PATCH 106/138] 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.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 77c37e1eb76e39d677d3a389deb8c294e4ea813f Mon Sep 17 00:00:00 2001 From: Miroslav Kos Date: Tue, 2 Dec 2014 15:03:49 +0100 Subject: [PATCH 107/138] 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 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 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 wrappers = new ArrayList(); + 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 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 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 initWrappersSchemaWithImports(List wrappers) { + Object o = model.databindingInfo().properties().get(DocWrappeeNamespapceQualified); + boolean wrappeeQualified = (o!= null && o instanceof Boolean) ? ((Boolean) o) : false; + HashMap xsds = new HashMap(); + HashMap> imports = new HashMap>(); + 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 importSet = imports.get(tns); + if (importSet == null) { + importSet = new HashSet(); + imports.put(tns, importSet); + } + importSet.add(nsToImport); + } + } + } + for(Entry> entry: imports.entrySet()) { + String tns = entry.getKey(); + Set 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("\n"); @@ -521,7 +521,7 @@ public abstract class AbstractSchemaValidationTube extends AbstractFilterTubeImp String systemId = e.getValue(); String ns = e.getKey(); 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 processedExceptions = new HashSet(); 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 wrappers = new ArrayList(); - 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 xsds = new HashMap(); - 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 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 annotate2(Class 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 annotations() { if (annotations == null) annotations = new ArrayList(); 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 annotations() { if (annotations == null) annotations = new ArrayList(); 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 annotations() { if (annotations == null) annotations = new ArrayList(); 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("&"); + else + if(ch=='>') + out.write(">"); 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 ...] \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 ...] \nOptionen: \n\\ \\ \\ \\ -d : Gibt an, wo die von Prozessor und javac generierten Klassendateien gespeichert werden sollen\n\\ \\ \\ \\ -cp : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -classpath : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -encoding : Gibt die Codierung f\u00FCr die Annotationsverarbeitung/den javac-Aufruf an \n\\ \\ \\ \\ -episode : 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 ...] \nOpciones: \n\\ \\ \\ \\ -d : especifique d\u00F3nde se colocan los archivos de clase generados por javac y el procesador\n\\ \\ \\ \\ -cp : especifique d\u00F3nde se encuentran los archivos especificados por el usuario\n\\ \\ \\ \\ -encoding : especifique la codificaci\u00F3n que se va a utilizar para el procesamiento de anotaciones/llamada de javac\n\\ \\ \\ \\ -episode : 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 ...] \nOptions : \n\ \ \ \ -d : indiquez o\u00F9 placer les fichiers de classe g\u00E9n\u00E9r\u00E9s par le processeur et le compilateur javac\n\ \ \ \ -cp : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -classpath : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -encoding : indiquez l'encodage \u00E0 utiliser pour l'appel de javac/traitement de l'annotation \n\ \ \ \ -episode : 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 ...] \nOpzioni: \n\ \ \ \ -d : specifica dove posizionare il processore e i file della classe generata javac\n\ \ \ \ -cp : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -classpath : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -encoding : specifica la codifica da usare per l'elaborazione dell'annotazione/richiamo javac \n\ \ \ \ -episode : 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 ...] \n\u30AA\u30D7\u30B7\u30E7\u30F3: \n\ \ \ \ -d : \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 : \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 : \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 : \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 : \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 ...] \n\uC635\uC158: \n\ \ \ \ -d : \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 : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -classpath : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -encoding : \uC8FC\uC11D \uCC98\uB9AC/javac \uD638\uCD9C\uC5D0 \uC0AC\uC6A9\uD560 \uC778\uCF54\uB529\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4. \n\ \ \ \ -episode : \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 ...] \nOp\u00E7\u00F5es: \n\\ \\ \\ \\ -d : especificar onde colocar o processador e os arquivos da classe gerados por javac\n\\ \\ \\ \\ -cp : especificar onde localizar arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -classpath : especificar onde localizar os arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -encoding : especificar codifica\u00E7\u00E3o a ser usada para processamento de anota\u00E7\u00E3o/chamada javac \n\\ \\ \\ \\ -episode : 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 ...] \n\u9009\u9879: \n\ \ \ \ -d : \u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -cp : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -classpath : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -encoding : \u6307\u5B9A\u7528\u4E8E\u6CE8\u91CA\u5904\u7406/javac \u8C03\u7528\u7684\u7F16\u7801\n\ \ \ \ -episode : \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 ...] \n\u9078\u9805: \n\\ \\ \\ \\ -d : \u6307\u5B9A\u8655\u7406\u5668\u4EE5\u53CA javac \u7522\u751F\u7684\u985E\u5225\u6A94\u6848\u653E\u7F6E\u4F4D\u7F6E\n\\ \\ \\ \\ -cp : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -classpath : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -encoding : \u6307\u5B9A\u8981\u7528\u65BC\u8A3B\u89E3\u8655\u7406/javac \u547C\u53EB\u7684\u7DE8\u78BC \n\\ \\ \\ \\ -episode : \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 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 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 +# DO NOT localize the 2.2.12-b141016.1821 string - it is a token for an mvn 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 http://java.sun.com/xml/jaxb \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 -Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11-b140528.1207 generiert \nSiehe http://java.sun.com/xml/jaxb \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 +Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b141016.1821 generiert \nSiehe http://java.sun.com/xml/jaxb \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 -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 http://java.sun.com/xml/jaxb \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 +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 http://java.sun.com/xml/jaxb \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 -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 http://java.sun.com/xml/jaxb \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 +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 http://java.sun.com/xml/jaxb \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 -Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.11-b140528.1207 \nVedere http://java.sun.com/xml/jaxb \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 +Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.12-b141016.1821 \nVedere http://java.sun.com/xml/jaxb \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 -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 \nhttp://java.sun.com/xml/jaxb\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 +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 \nhttp://java.sun.com/xml/jaxb\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 -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. \nhttp://java.sun.com/xml/jaxb\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 +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. \nhttp://java.sun.com/xml/jaxb\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 -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 http://java.sun.com/xml/jaxb \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 +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 http://java.sun.com/xml/jaxb \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 -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 http://java.sun.com/xml/jaxb \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 +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 http://java.sun.com/xml/jaxb \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 -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 http://java.sun.com/xml/jaxb \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 +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 http://java.sun.com/xml/jaxb \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 perSchema = new HashMap(); + Map perSchema = new LinkedHashMap(); 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 packageNames = new HashSet(); - 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 accept(CPropertyVisitor visitor) { return visitor.onAttribute(this); } + @Override + public R accept(CPropertyVisitor2 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. * *

    * 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 accept(CPropertyVisitor2 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, CCust public abstract V accept( CPropertyVisitor visitor ); + public abstract R accept( CPropertyVisitor2 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 the return type of this visitor's methods. Use {@link + * Void} for visitors that do not need to return results. + * @param

    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 { + + /** + * 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 accept(CPropertyVisitor2 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 accept(CPropertyVisitor visitor) { return visitor.onValue(this); } + + @Override + public R accept(CPropertyVisitor2 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, CCustom * The element mappings. */ private final Map> elementMappings = - new HashMap>(); + new LinkedHashMap>(); private final Iterable allElements = new Iterable() { @@ -132,11 +130,11 @@ public final class Model implements TypeInfoSet, 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, CCustom this.defaultSymbolSpace = new SymbolSpace(codeModel); defaultSymbolSpace.setType(codeModel.ref(Object.class)); - elementMappings.put(null,new HashMap()); + elementMappings.put(null, new LinkedHashMap()); 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, CCustom * global element declarations to its representation class. * *

    - * 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, CCustom * Gets the global customizations. */ public CCustomizations getCustomizations() { - return gloablCustomizations; + return globalCustomizations; } /** @@ -466,7 +464,7 @@ public final class Model implements TypeInfoSet, CCustom Map m = elementMappings.get(clazz); if(m==null) - elementMappings.put(clazz,m=new HashMap()); + elementMappings.put(clazz, m = new LinkedHashMap()); 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. * *

    - * 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 { *

    * Set of system ids as strings. */ - private final Set rootDocuments = new HashSet(); + private final Set rootDocuments = new LinkedHashSet(); /** 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 elems = new HashMap(); + private final Map elems = new LinkedHashMap(); private final Map 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 allTypes = new HashMap(); + private final Map allTypes = new LinkedHashMap(); private final Map allTypesView = Collections.unmodifiableMap(allTypes); private final Map simpleTypes = new HashMap(); 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 . + * 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 . * */ 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 . @@ -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// 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// -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 . +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 . 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// -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// -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// -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// -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 . +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 . 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// -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// -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 . +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 . 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// -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 diagnostics = new DiagnosticCollector(); 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 getExternalFiles(List exts) { List files = new ArrayList(); 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 Date: Tue, 2 Dec 2014 15:11:05 +0100 Subject: [PATCH 108/138] 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 e3a64209bc7ec9269b7c6714b3a666a17ff0e9fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Wed, 3 Dec 2014 11:43:57 +0100 Subject: [PATCH 109/138] 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 d739446063a7c03f92ae7535be3ef55491857722 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Wed, 3 Dec 2014 13:46:12 +0100 Subject: [PATCH 110/138] 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 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 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 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 getSymbols(Filter sf, LookupKind lookupKind) { + public Iterable getSymbols(final Filter 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 doLookup(TypeSymbol tsym) { + return tsym.members().getSymbols(sf, lookupKind); + } + }; + return si.importFrom((TypeSymbol) origin.owner) :: iterator; } @Override - public Iterable getSymbolsByName(Name name, - Filter sf, - LookupKind lookupKind) { + public Iterable getSymbolsByName(final Name name, + final Filter 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 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 { - private final Iterator delegate; - private Symbol next; - - public FilteredIterator(Iterator delegate) { - this.delegate = delegate; - update(); + abstract class SymbolImporter { + Set processed = new HashSet<>(); + List> delegates = List.nil(); + final boolean inspectSuperTypes; + public SymbolImporter(boolean inspectSuperTypes) { + this.inspectSuperTypes = inspectSuperTypes; } + Stream 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 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 { - - private final Iterable unfiltered; - - public FilteredIterable(Iterable unfiltered) { - this.unfiltered = unfiltered; - } - - @Override - public Iterator iterator() { - return new FilteredIterator(unfiltered.iterator()); + return Stream.concat(StreamSupport.stream(doLookup(tsym).spliterator(), false) + .filter(s -> filter.accepts(origin, s)), + result); } + abstract Iterable 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.nil(), List.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 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())) { - log.error(imp.pos(), "cant.resolve.location", - KindName.STATIC, - select.name, List.nil(), List.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())) { + log.error(imp.pos(), "cant.resolve.location", + KindName.STATIC, + select.name, List.nil(), List.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: * *

    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. * *

    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. * *

    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. * *

    Classes migrate from one phase to the next via queues: * *

    {@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)
      *  }
    @@ -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 trees, ClassSymbol c) { annotate.enterStart(); ListBuffer 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 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. * *

    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. */ -public class MemberEnter extends JCTree.Visitor implements Completer { +public class MemberEnter extends JCTree.Visitor { protected static final Context.Key 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> 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 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 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 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 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()); - 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 maskedOut; - - public MaskedImportFilter(ImportFilter delegate, Set 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 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 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 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 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 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 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.nil(), - List.nil(), - List.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.nil(), - List.of(make.VarDef(make.Modifiers(Flags.PARAMETER | - Flags.MANDATED), - names.fromString("name"), - make.Type(syms.stringType), null)), - List.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 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 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 annotations) { - for (List 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 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 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 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 interfaces = new ListBuffer<>(); - ListBuffer all_interfaces = null; // lazy init - Set interfaceSet = new HashSet<>(); - List 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().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 argtypes = List.nil(); - List typarams = List.nil(); - List 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 topLevels = new HashSet<>(); - try { - while (halfcompleted.nonEmpty()) { - Env 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 baseEnv(JCClassDecl tree, Env 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 typarams = tree.typarams; - typarams.nonEmpty(); - typarams = typarams.tail) - baseScope.enter(typarams.head.type.tsym); - Env outer = env.outer; // the base clause can't see members of this class - Env 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 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.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 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 visit(List trees) { - ListBuffer 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 actuals = visit(tree.arguments); - result = new ErrorType(tree.type, clazzType.tsym) { - @Override @DefinedBy(Api.LANGUAGE_MODEL) - public List 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 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 typarams, - List argtypes, - List 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 params = make.Params(argtypes, init); - List 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 createDefaultConstructorParams( - TreeMaker make, - MethodSymbol baseInit, - MethodSymbol init, - List argtypes, - boolean based) { - List initParams = null; - List 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.nil() : initParams; - List 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 typarams, - List 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 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. + * + *

    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. + */ +public class TypeEnter implements Completer { + protected static final Context.Key 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 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 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> 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 seen = new HashSet<>(); + + for (Env 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> queue = new ListBuffer<>(); + private final Phase next; + private final CompletionCause phaseName; + + Phase(CompletionCause phaseName, Phase next) { + this.phaseName = phaseName; + this.next = next; + } + + public List> runPhase(List> envs) { + boolean firstToComplete = queue.isEmpty(); + + for (Env 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> out = queue.toList(); + + queue.clear(); + return next != null ? next.runPhase(out) : out; + } else { + return List.nil(); + } + } + + protected abstract void doRunPhase(Env 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 env; + ImportFilter staticImportFilter; + ImportFilter typeImportFilter = new ImportFilter() { + @Override + public boolean accepts(Scope origin, Symbol t) { + return t.kind == TYP; + } + }; + + @Override + protected void doRunPhase(Env 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 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 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 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 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 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 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 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 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 baseEnv(JCClassDecl tree, Env 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 typarams = tree.typarams; + typarams.nonEmpty(); + typarams = typarams.tail) + baseScope.enter(typarams.head.type.tsym); + Env outer = env.outer; // the base clause can't see members of this class + Env 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.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 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 visit(List trees) { + ListBuffer 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 actuals = visit(tree.arguments); + result = new ErrorType(tree.type, clazzType.tsym) { + @Override @DefinedBy(Api.LANGUAGE_MODEL) + public List 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 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 env, Env 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 interfaces = new ListBuffer<>(); + ListBuffer all_interfaces = null; // lazy init + List 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().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 env) { + JCClassDecl tree = env.enclClass; + ClassSymbol sym = tree.sym; + ClassType ct = (ClassType)sym.type; + + Env 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 annotations) { + for (List 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 env) { + JCClassDecl tree = env.enclClass; + ClassSymbol sym = tree.sym; + ClassType ct = (ClassType)sym.type; + + // create an environment for evaluating the base clauses + Env 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 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 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 argtypes = List.nil(); + List typarams = List.nil(); + List 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 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 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.nil(), + List.nil(), + List.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.nil(), + List.of(make.VarDef(make.Modifiers(Flags.PARAMETER | + Flags.MANDATED), + names.fromString("name"), + make.Type(syms.stringType), null)), + List.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 typarams, + List argtypes, + List 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 params = make.Params(argtypes, init); + List 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 createDefaultConstructorParams( + TreeMaker make, + MethodSymbol baseInit, + MethodSymbol init, + List argtypes, + boolean based) { + List initParams = null; + List 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.nil() : initParams; + List 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 typarams, + List 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 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 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 { + + boolean errorFound; + + public void report(Diagnostic 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 { + + boolean errorFound; + + public void report(Diagnostic 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 { 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 { 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 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 tests = Files.list(src)) { + tests.map(p -> Files.isRegularFile(p) ? Stream.of(p) : silentWalk(p)) + .forEach(this :: runTest); + } + } + + Stream silentWalk(Path src) { + try { + return Files.walk(src).filter(Files :: isRegularFile); + } catch (IOException ex) { + throw new IllegalStateException(ex); + } + } + + void runTest(Stream inputs) { + JavacTool tool = JavacTool.create(); + try (JavacFileManager fm = tool.getStandardFileManager(null, null, null)) { + Path classes = Paths.get(System.getProperty("test.classes")); + Iterable reconFiles = + fm.getJavaFileObjectsFromFiles(inputs.sorted().map(p -> p.toFile()) :: iterator); + List options = Arrays.asList("-classpath", classes.toAbsolutePath().toString()); + JavacTask reconTask = tool.getTask(null, fm, null, options, null, reconFiles); + Iterable reconUnits = reconTask.parse(); + JavacTrees reconTrees = JavacTrees.instance(reconTask); + SearchAnnotations scanner = new SearchAnnotations(reconTrees, + reconTask.getElements()); + List 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) TestDependencies :: new); + } + + public TestDependencies(Context context) { + super(context); + } + + final Stack inProcess = new Stack<>(); + + String topLevelMemberEnter; + Map> 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 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 { + final Trees trees; + final Elements elements; + final TypeElement triggersCompleteAnnotation; + final TypeElement triggersCompleteRepeatAnnotation; + final Map> 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 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 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) findAttribute(am, "value").getValue(); + } + } + return Collections.emptyList(); + } + + AnnotationValue findAttribute(AnnotationMirror mirror, String name) { + for (Entry 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 { + final SourcePositions positions; + final List 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 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 { 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 { 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 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 packages = new ArrayList(); int nextPackageSerial; From 8d3af43a7c1a5e455377b9a44365b937d9c150c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Wed, 3 Dec 2014 14:49:36 +0100 Subject: [PATCH 111/138] 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 deabb040d5bcfcb068b93b0d8eb9bee717c8e4f0 Mon Sep 17 00:00:00 2001 From: Attila Szegedi Date: Wed, 3 Dec 2014 16:31:15 +0100 Subject: [PATCH 112/138] 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 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 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 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 Date: Wed, 3 Dec 2014 16:31:39 +0100 Subject: [PATCH 113/138] 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 Date: Wed, 3 Dec 2014 19:49:59 +0000 Subject: [PATCH 114/138] 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 7e500d532492437658e6736d6279809f3fa40406 Mon Sep 17 00:00:00 2001 From: Lance Andersen Date: Wed, 3 Dec 2014 16:50:55 -0500 Subject: [PATCH 115/138] 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 SQLPermission 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 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() { 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 Date: Thu, 4 Dec 2014 16:50:31 +0800 Subject: [PATCH 116/138] 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 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 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 +MIIDpTCCA6EGCyqGSIb3DQEMCgECoIICtjCCArIwHAYKKoZIhvc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EKF45J5vyQxrNabZXeovNIVZryK+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+iQUY9L8j4xrWsr2JN5tAgYcWz1qZrp4cx0he9cb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9MLrlEISHM4zC7DlkbRSD7LyXyI4weh +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 +AgEAMIIC8QYJKoZIhvcNAQcBMCgGCiqGSIb3DQE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oRg0DR9g4gUVdjzgQULlm+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 +NYMJGAGH5gpJezdNQD6wimRiEGIs1y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w0ssNJYQ4GB4gBc7x3UXnyau5aDO9n6KMT4wFwYJKoZIhvcNAQkUMQoeCAB1 +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+cgKGxthqaL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u/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/2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TCig +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/eJboGbRqUFobFY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kQhWW+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/LSjOOgk4WdrJGx4cUwnr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kRhQbzszd0URUK0 +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 +S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CNJK0YsQ9ckYhXDBiafOF3n9MAG4I +821xWdCWnQ2YUIlybCpW6jEkL+jFtfDCt1EYaGvWPMHR181YONJUf4MVtaE4ynq1pvDLLJ/1i+VM +8zCc3lfm9mQDnqap0MBRVJzD3uHceCxG2bZTH2W4N16MEWU6ANmRJEXJfRWB1rPbb0lQMIEx8CJE +IPxVPYg3enRjxx0Ciq3wfEKmhKCRyLE8tcR40aFkLReumxSI85fXsXEtIOD1A6+OKC32fYzSvwNK +hIdVt/9sIgMOgVQbEXM0rAJgayfPulQyB19OZWUUg+zVMDjgudV6cWRRz/V+0U7Ajq3IZOsE5PtU +FgNW1MI40XfEdWafFXeJ+yQTHPyoNdk= \ No newline at end of file From 949112fab25835e9be3e12894f97fd322d4bad5f Mon Sep 17 00:00:00 2001 From: Athijegannathan Sundararajan Date: Thu, 4 Dec 2014 20:40:48 +0530 Subject: [PATCH 117/138] 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 @@ - + - + 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() { + @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 Date: Thu, 4 Dec 2014 07:15:37 -0800 Subject: [PATCH 118/138] 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 { 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 m = (ConcurrentHashMap) 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[] 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[] 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 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 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 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 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 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 Date: Thu, 4 Dec 2014 21:52:58 +0530 Subject: [PATCH 119/138] 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 Date: Thu, 4 Dec 2014 12:58:11 -0800 Subject: [PATCH 120/138] 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 Date: Thu, 4 Dec 2014 12:58:12 -0800 Subject: [PATCH 121/138] 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 Date: Thu, 4 Dec 2014 12:58:13 -0800 Subject: [PATCH 122/138] 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 Date: Thu, 4 Dec 2014 12:58:16 -0800 Subject: [PATCH 123/138] 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 Date: Thu, 4 Dec 2014 12:58:16 -0800 Subject: [PATCH 124/138] 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 Date: Thu, 4 Dec 2014 12:58:17 -0800 Subject: [PATCH 125/138] 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 Date: Thu, 4 Dec 2014 12:58:21 -0800 Subject: [PATCH 126/138] 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 Date: Thu, 4 Dec 2014 12:58:22 -0800 Subject: [PATCH 127/138] 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 Date: Thu, 4 Dec 2014 12:59:43 -0800 Subject: [PATCH 128/138] 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, 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 e : entrySet()) { StringBuffer buffer = new StringBuffer( @@ -325,6 +326,7 @@ public class Attributes implements Map, 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, 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 de3548c4b99231789b53f1f76ac943687c8c491a Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Thu, 4 Dec 2014 14:57:40 -0800 Subject: [PATCH 129/138] 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 Date: Thu, 4 Dec 2014 15:04:11 -0800 Subject: [PATCH 130/138] 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.
    * 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 1e89746cb2e9dfe85849ab25a09ade365599027e Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 20:08:43 +0200 Subject: [PATCH 131/138] 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 765c10de6e60c145231bc67f1b95b9ec7abb8f03 Mon Sep 17 00:00:00 2001 From: Stuart Marks Date: Thu, 4 Dec 2014 18:54:37 -0800 Subject: [PATCH 132/138] 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 7e7e10eb420a69f71e1c08411b52336b6436368f Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Fri, 5 Dec 2014 12:20:51 +0100 Subject: [PATCH 133/138] 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 + // 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 allowAll = new ThreadLocal() { + @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 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 allowAll; // actually: this should be in a thread locale + public SimplePolicy(TestCase test, ThreadLocal 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 421fc583bedb3bb0ef421a4b752ff200cc3e296a Mon Sep 17 00:00:00 2001 From: Pavel Rappo Date: Fri, 5 Dec 2014 15:35:15 +0000 Subject: [PATCH 134/138] 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. * *

    This class defines static methods that support the interoperation of the - * stream classes of the {@link java.io} package with the channel - * classes of this package.

    + * stream classes of the {@link java.io} package with the channel classes + * of this package.

    * * * @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. * - *

    The read methods of the resulting stream will throw an + *

    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. * - *

    The write methods of the resulting stream will throw an + *

    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. * *

    The resulting stream will contain an internal input buffer of at - * least minBufferCap bytes. The stream's read 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 -1 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 { * *

    An invocation of this method of the form * - *

    -     * Channels.newReader(ch, csname)
    + *
     {@code
    +     *     Channels.newReader(ch, csname)
    +     * } 
    * * behaves in exactly the same way as the expression * - *
    -     * Channels.newReader(ch,
    -     *                    Charset.forName(csName)
    -     *                        .newDecoder(),
    -     *                    -1);
    + *
     {@code
    +     *     Channels.newReader(ch, Charset.forName(csName).newDecoder(), -1)
    +     * } 
    * * @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. * *

    The resulting stream will contain an internal output buffer of at - * least minBufferCap bytes. The stream's write 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 -1 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. * *

    An invocation of this method of the form - * - *

    -     * Channels.newWriter(ch, csname)
    - * + *

    + *

     {@code
    +     *     Channels.newWriter(ch, csname)
    +     * } 
    * behaves in exactly the same way as the expression - * - *
    -     * Channels.newWriter(ch,
    -     *                    Charset.forName(csName)
    -     *                        .newEncoder(),
    -     *                    -1);
    + *

    + *

     {@code
    +     *     Channels.newWriter(ch, Charset.forName(csName).newEncoder(), -1)
    +     * } 
    * * @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 Date: Fri, 5 Dec 2014 19:46:15 +0100 Subject: [PATCH 135/138] 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 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 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 Date: Fri, 5 Dec 2014 20:13:05 +0000 Subject: [PATCH 136/138] 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 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 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() { + 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 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 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 c278cc80e9fe9f75d5dcd943b9e3438416bf969f Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Fri, 5 Dec 2014 17:36:18 -0800 Subject: [PATCH 137/138] 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 Date: Sun, 7 Dec 2014 07:10:29 +0000 Subject: [PATCH 138/138] 8064407: (fc) FileChannel transferTo should use TransmitFile on Windows Co-authored-by: Valeriy Kopylov 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() { + @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 +#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;